@citolab/qti-components 10.0.0-next.19 → 10.0.0-next.20
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/cdn/index.global.js +1 -1
- package/cdn/index.js +176 -176
- package/dist/base.d.ts +2 -2
- package/dist/base.js +1 -1
- package/dist/{chunk-4UO6AGJ6.js → chunk-2A52V5TQ.js} +3 -3
- package/dist/{chunk-Y7RSSGDY.js → chunk-5BP2A7BI.js} +2 -2
- package/dist/{chunk-WTGUKDVH.js → chunk-DAESCCLR.js} +2 -2
- package/dist/{chunk-QKCVC4HF.js → chunk-GJWA6LLT.js} +2 -2
- package/dist/{chunk-XBBTYGCX.js → chunk-GPC53O7P.js} +3 -3
- package/dist/{chunk-XBBTYGCX.js.map → chunk-GPC53O7P.js.map} +1 -1
- package/dist/{chunk-MFKH6BZM.js → chunk-H6DO5UHC.js} +3 -3
- package/dist/{chunk-HSOILZC6.js → chunk-KQ2LED4X.js} +2 -2
- package/dist/{chunk-3FQZRJFH.js → chunk-LPYZVKHX.js} +2 -2
- package/dist/{chunk-JE6X3IZT.js → chunk-ORQFZNJW.js} +192 -64
- package/dist/chunk-ORQFZNJW.js.map +1 -0
- package/dist/{chunk-QECECKEC.js → chunk-TSJGL6FI.js} +2 -2
- package/dist/{chunk-MXY66QOH.js → chunk-TZCOXFPB.js} +2 -2
- package/dist/{chunk-DAOLVUTR.js → chunk-XWRZP2RM.js} +2 -2
- package/dist/{chunk-YRXH3YMJ.js → chunk-Y6Q3F2S7.js} +7 -7
- package/dist/{chunk-YRXH3YMJ.js.map → chunk-Y6Q3F2S7.js.map} +1 -1
- package/dist/{chunk-LORYM4U2.js → chunk-ZRORBAHB.js} +3 -3
- package/dist/chunk-ZRORBAHB.js.map +1 -0
- package/dist/computed.types.d-6Ht-HNRx.d.ts +80 -0
- package/dist/corrections.d.ts +2 -2
- package/dist/corrections.js +8 -8
- package/dist/elements.js +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.js +14 -14
- package/dist/interactions.js +3 -3
- package/dist/item.js +4 -4
- package/dist/loader.js +2 -2
- package/dist/processing.js +3 -3
- package/dist/{qti-test-state-BAf5AmJ2.d.ts → qti-test-state-CF9S8X9C.d.ts} +1 -1
- package/dist/{qti-test.d-CRqJF2DM.d.ts → qti-test.d-sskv-dEN.d.ts} +1 -1
- package/dist/test-plugin-api.d.ts +2 -2
- package/dist/test.d.ts +4 -4
- package/dist/test.js +5 -5
- package/dist/transformers.js +1 -1
- package/package.json +6 -5
- package/dist/chunk-JE6X3IZT.js.map +0 -1
- package/dist/chunk-LORYM4U2.js.map +0 -1
- package/dist/computed.types.d-D4wskgi0.d.ts +0 -51
- /package/dist/{chunk-4UO6AGJ6.js.map → chunk-2A52V5TQ.js.map} +0 -0
- /package/dist/{chunk-Y7RSSGDY.js.map → chunk-5BP2A7BI.js.map} +0 -0
- /package/dist/{chunk-WTGUKDVH.js.map → chunk-DAESCCLR.js.map} +0 -0
- /package/dist/{chunk-QKCVC4HF.js.map → chunk-GJWA6LLT.js.map} +0 -0
- /package/dist/{chunk-MFKH6BZM.js.map → chunk-H6DO5UHC.js.map} +0 -0
- /package/dist/{chunk-HSOILZC6.js.map → chunk-KQ2LED4X.js.map} +0 -0
- /package/dist/{chunk-3FQZRJFH.js.map → chunk-LPYZVKHX.js.map} +0 -0
- /package/dist/{chunk-QECECKEC.js.map → chunk-TSJGL6FI.js.map} +0 -0
- /package/dist/{chunk-MXY66QOH.js.map → chunk-TZCOXFPB.js.map} +0 -0
- /package/dist/{chunk-DAOLVUTR.js.map → chunk-XWRZP2RM.js.map} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-4DB4SC5K.js";
|
|
7
7
|
import {
|
|
8
8
|
qtiTransformItem
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZRORBAHB.js";
|
|
10
10
|
import {
|
|
11
11
|
QtiExitResponseSignal,
|
|
12
12
|
QtiFeedback,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
itemContext,
|
|
16
16
|
itemContextVariables,
|
|
17
17
|
readRecordFieldValues
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-GPC53O7P.js";
|
|
19
19
|
|
|
20
20
|
// ../qti-elements/dist/components/qti-assessment-item/qti-assessment-item.js
|
|
21
21
|
import { provide } from "@lit/context";
|
|
@@ -1828,4 +1828,4 @@ export {
|
|
|
1828
1828
|
QtiTemplateProcessing,
|
|
1829
1829
|
qtiContentElements
|
|
1830
1830
|
};
|
|
1831
|
-
//# sourceMappingURL=chunk-
|
|
1831
|
+
//# sourceMappingURL=chunk-H6DO5UHC.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
qtiItemElements
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2A52V5TQ.js";
|
|
4
4
|
|
|
5
5
|
// ../qti-item/dist/register.js
|
|
6
6
|
for (const { tag, ctor } of qtiItemElements) {
|
|
@@ -8,4 +8,4 @@ for (const { tag, ctor } of qtiItemElements) {
|
|
|
8
8
|
customElements.define(tag, ctor);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-KQ2LED4X.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
isRecordValue,
|
|
10
10
|
itemContext,
|
|
11
11
|
testContext
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-GPC53O7P.js";
|
|
13
13
|
|
|
14
14
|
// ../qti-processing/dist/components/qti-and/qti-and.js
|
|
15
15
|
var QtiAnd = class extends qtiAndMixin(QtiConditionExpression) {
|
|
@@ -3385,4 +3385,4 @@ export {
|
|
|
3385
3385
|
QtiVariable,
|
|
3386
3386
|
qtiProcessingElements
|
|
3387
3387
|
};
|
|
3388
|
-
//# sourceMappingURL=chunk-
|
|
3388
|
+
//# sourceMappingURL=chunk-LPYZVKHX.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-J6VX4N7M.js";
|
|
8
8
|
import {
|
|
9
9
|
QtiModalFeedback
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-H6DO5UHC.js";
|
|
11
11
|
import {
|
|
12
12
|
listenPublic
|
|
13
13
|
} from "./chunk-UCXLDQYA.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
qtiTransformItem,
|
|
22
22
|
qtiTransformTest
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ZRORBAHB.js";
|
|
24
24
|
import {
|
|
25
25
|
INITIAL_SESSION_CONTEXT,
|
|
26
26
|
INITIAL_TEST_CONTEXT,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
qtiContext,
|
|
32
32
|
sessionContext,
|
|
33
33
|
testContext
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-GPC53O7P.js";
|
|
35
35
|
|
|
36
36
|
// ../qti-test/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js
|
|
37
37
|
import { LitElement, nothing as nothing2 } from "lit";
|
|
@@ -1625,6 +1625,116 @@ var QtiOutcomeProcessingProcessor = class {
|
|
|
1625
1625
|
// ../qti-test/dist/components/qti-test-feedback/qti-test-feedback.js
|
|
1626
1626
|
import { css as css4, html as html7 } from "lit";
|
|
1627
1627
|
import { property as property6 } from "lit/decorators.js";
|
|
1628
|
+
|
|
1629
|
+
// ../qti-delivery/dist/model/xml-node.js
|
|
1630
|
+
var ELEMENT_NODE = 1;
|
|
1631
|
+
function childElements(parent, ...localNames) {
|
|
1632
|
+
const nodes = parent.childNodes;
|
|
1633
|
+
const children = [];
|
|
1634
|
+
for (let index = 0; index < nodes.length; index++) {
|
|
1635
|
+
const node = nodes[index];
|
|
1636
|
+
if (node.nodeType === ELEMENT_NODE && localNames.includes(node.localName ?? "")) {
|
|
1637
|
+
children.push(node);
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
return children;
|
|
1641
|
+
}
|
|
1642
|
+
var childElement = (parent, localName) => childElements(parent, localName)[0] ?? null;
|
|
1643
|
+
function booleanAttribute(element, name) {
|
|
1644
|
+
const value = element.getAttribute(name)?.trim();
|
|
1645
|
+
if (value === "true" || value === "1")
|
|
1646
|
+
return true;
|
|
1647
|
+
if (value === "false" || value === "0")
|
|
1648
|
+
return false;
|
|
1649
|
+
return void 0;
|
|
1650
|
+
}
|
|
1651
|
+
function integerAttribute(element, name) {
|
|
1652
|
+
const value = element.getAttribute(name)?.trim();
|
|
1653
|
+
return value && /^[+-]?\d+$/.test(value) ? Number(value) : void 0;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
// ../qti-delivery/dist/model/test-model.js
|
|
1657
|
+
var DEFAULT_SESSION_CONTROL = Object.freeze({
|
|
1658
|
+
maxAttempts: 1,
|
|
1659
|
+
showFeedback: false,
|
|
1660
|
+
allowReview: true,
|
|
1661
|
+
showSolution: false,
|
|
1662
|
+
allowComment: false,
|
|
1663
|
+
allowSkipping: true,
|
|
1664
|
+
validateResponses: false
|
|
1665
|
+
});
|
|
1666
|
+
function buildTestModel(test) {
|
|
1667
|
+
if (test.localName !== "qti-assessment-test") {
|
|
1668
|
+
throw new TypeError(`Expected a qti-assessment-test element, not ${String(test.localName)}.`);
|
|
1669
|
+
}
|
|
1670
|
+
return {
|
|
1671
|
+
identifier: test.getAttribute("identifier") ?? "",
|
|
1672
|
+
title: test.getAttribute("title") ?? "",
|
|
1673
|
+
testParts: childElements(test, "qti-test-part").map(buildTestPart)
|
|
1674
|
+
};
|
|
1675
|
+
}
|
|
1676
|
+
function buildTestPart(part) {
|
|
1677
|
+
const sessionControl = resolveSessionControl(DEFAULT_SESSION_CONTROL, part);
|
|
1678
|
+
return {
|
|
1679
|
+
identifier: part.getAttribute("identifier") ?? "",
|
|
1680
|
+
navigationMode: part.getAttribute("navigation-mode") === "linear" ? "linear" : "nonlinear",
|
|
1681
|
+
submissionMode: part.getAttribute("submission-mode") === "simultaneous" ? "simultaneous" : "individual",
|
|
1682
|
+
sessionControl,
|
|
1683
|
+
sections: childElements(part, "qti-assessment-section").map((section) => buildSection(section, sessionControl))
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1686
|
+
function buildSection(section, inherited) {
|
|
1687
|
+
const sessionControl = resolveSessionControl(inherited, section);
|
|
1688
|
+
return {
|
|
1689
|
+
kind: "section",
|
|
1690
|
+
identifier: section.getAttribute("identifier") ?? "",
|
|
1691
|
+
title: section.getAttribute("title") ?? "",
|
|
1692
|
+
visible: booleanAttribute(section, "visible") ?? true,
|
|
1693
|
+
sessionControl,
|
|
1694
|
+
content: childElements(section, "qti-assessment-section", "qti-assessment-item-ref").map((child) => child.localName === "qti-assessment-section" ? buildSection(child, sessionControl) : buildItemRef(child, sessionControl))
|
|
1695
|
+
};
|
|
1696
|
+
}
|
|
1697
|
+
function buildItemRef(itemRef, inherited) {
|
|
1698
|
+
const category = itemRef.getAttribute("category")?.trim();
|
|
1699
|
+
return {
|
|
1700
|
+
kind: "itemRef",
|
|
1701
|
+
identifier: itemRef.getAttribute("identifier") ?? "",
|
|
1702
|
+
href: itemRef.getAttribute("href") ?? "",
|
|
1703
|
+
categories: category ? category.split(/\s+/) : [],
|
|
1704
|
+
sessionControl: resolveSessionControl(inherited, itemRef),
|
|
1705
|
+
declaredSessionControl: declaredSessionControl(itemRef)
|
|
1706
|
+
};
|
|
1707
|
+
}
|
|
1708
|
+
function resolveSessionControl(inherited, owner) {
|
|
1709
|
+
return { ...inherited, ...declaredSessionControl(owner) };
|
|
1710
|
+
}
|
|
1711
|
+
function declaredSessionControl(owner) {
|
|
1712
|
+
const element = childElement(owner, "qti-item-session-control");
|
|
1713
|
+
if (!element)
|
|
1714
|
+
return {};
|
|
1715
|
+
const declared = {
|
|
1716
|
+
maxAttempts: integerAttribute(element, "max-attempts"),
|
|
1717
|
+
showFeedback: booleanAttribute(element, "show-feedback"),
|
|
1718
|
+
allowReview: booleanAttribute(element, "allow-review"),
|
|
1719
|
+
showSolution: booleanAttribute(element, "show-solution"),
|
|
1720
|
+
allowComment: booleanAttribute(element, "allow-comment"),
|
|
1721
|
+
allowSkipping: booleanAttribute(element, "allow-skipping"),
|
|
1722
|
+
validateResponses: booleanAttribute(element, "validate-responses")
|
|
1723
|
+
};
|
|
1724
|
+
return Object.fromEntries(Object.entries(declared).filter(([, value]) => value !== void 0));
|
|
1725
|
+
}
|
|
1726
|
+
var ownItemRefs = (section) => section.content.filter((child) => child.kind === "itemRef");
|
|
1727
|
+
function sectionsInOrder(sections) {
|
|
1728
|
+
return sections.flatMap((section) => [
|
|
1729
|
+
section,
|
|
1730
|
+
...sectionsInOrder(section.content.filter((child) => child.kind === "section"))
|
|
1731
|
+
]);
|
|
1732
|
+
}
|
|
1733
|
+
function itemRefsInOrder(sections) {
|
|
1734
|
+
return sections.flatMap((child) => child.kind === "itemRef" ? [child] : itemRefsInOrder(child.content));
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
// ../qti-test/dist/components/qti-test-feedback/qti-test-feedback.js
|
|
1628
1738
|
var __decorate7 = function(decorators, target, key, desc) {
|
|
1629
1739
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1630
1740
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3085,7 +3195,7 @@ var TestEndAttempt = class extends LitElement12 {
|
|
|
3085
3195
|
this._internalDisabled = false;
|
|
3086
3196
|
return;
|
|
3087
3197
|
}
|
|
3088
|
-
const maxAttempts = activeItem.maxAttempts ?? 1;
|
|
3198
|
+
const maxAttempts = activeItem.sessionControl?.maxAttempts ?? 1;
|
|
3089
3199
|
const numAttempts = activeItem.numAttempts || 0;
|
|
3090
3200
|
if (!activeItem.adaptive && activeItem.optimal) {
|
|
3091
3201
|
this._internalDisabled = true;
|
|
@@ -3099,7 +3209,7 @@ var TestEndAttempt = class extends LitElement12 {
|
|
|
3099
3209
|
this._internalDisabled = true;
|
|
3100
3210
|
return;
|
|
3101
3211
|
}
|
|
3102
|
-
if (this.requireAnswer || activeItem.allowSkipping === false) {
|
|
3212
|
+
if (this.requireAnswer || activeItem.sessionControl?.allowSkipping === false) {
|
|
3103
3213
|
this._internalDisabled = activeItem.valid === false || activeItem.isDefaultResponse;
|
|
3104
3214
|
} else {
|
|
3105
3215
|
this._internalDisabled = false;
|
|
@@ -3130,6 +3240,20 @@ __decorate14([
|
|
|
3130
3240
|
import { ContextConsumer, consume as consume8, provide as provide3 } from "@lit/context";
|
|
3131
3241
|
import { html as html11, LitElement as LitElement13 } from "lit";
|
|
3132
3242
|
import { property as property12, state as state4 } from "lit/decorators.js";
|
|
3243
|
+
|
|
3244
|
+
// ../qti-test/dist/internal/rendered-markup.js
|
|
3245
|
+
function renderedMarkup(element) {
|
|
3246
|
+
return {
|
|
3247
|
+
nodeType: element.nodeType,
|
|
3248
|
+
localName: element.localName,
|
|
3249
|
+
get childNodes() {
|
|
3250
|
+
return Array.from(element.children, renderedMarkup);
|
|
3251
|
+
},
|
|
3252
|
+
getAttribute: (name) => element.getAttribute(name) ?? (name === "title" ? element.getAttribute("data-title") : null)
|
|
3253
|
+
};
|
|
3254
|
+
}
|
|
3255
|
+
|
|
3256
|
+
// ../qti-test/dist/components/test-navigation/test-navigation.js
|
|
3133
3257
|
var __decorate15 = function(decorators, target, key, desc) {
|
|
3134
3258
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3135
3259
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3203,6 +3327,8 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3203
3327
|
this.autoScoreItems = false;
|
|
3204
3328
|
this.#optimality = /* @__PURE__ */ new Map();
|
|
3205
3329
|
this.#itemElement = (identifier) => this.#assessmentItemFor(identifier) ?? null;
|
|
3330
|
+
this.#sectionItems = /* @__PURE__ */ new Map();
|
|
3331
|
+
this.#itemOrder = [];
|
|
3206
3332
|
this.#lockedItems = /* @__PURE__ */ new WeakSet();
|
|
3207
3333
|
listenPublic2(this, "qc-test-loaded", this.#handleTestConnected.bind(this));
|
|
3208
3334
|
this.addEventListener("qti-assessment-item-connected", this.#handleItemConnected.bind(this));
|
|
@@ -3229,7 +3355,7 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3229
3355
|
const computedItem = this.computedItemFor(itemContext.identifier);
|
|
3230
3356
|
const numAttempts = Number(itemContext.variables?.find((v) => v.identifier === "numAttempts")?.value) || 0;
|
|
3231
3357
|
const completionStatus = itemContext.variables?.find((v) => v.identifier === "completionStatus")?.value;
|
|
3232
|
-
this.afterAttemptEnded(event.composedPath()[0]?.closest("qti-assessment-item"), computedItem, this.#isItemDone(numAttempts, optimality, computedItem?.maxAttempts, computedItem?.adaptive, completionStatus));
|
|
3358
|
+
this.afterAttemptEnded(event.composedPath()[0]?.closest("qti-assessment-item"), computedItem, this.#isItemDone(numAttempts, optimality, computedItem?.sessionControl?.maxAttempts, computedItem?.adaptive, completionStatus));
|
|
3233
3359
|
}
|
|
3234
3360
|
/**
|
|
3235
3361
|
* Extension point for presentation packages reacting to an ended attempt.
|
|
@@ -3323,63 +3449,65 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3323
3449
|
});
|
|
3324
3450
|
}
|
|
3325
3451
|
});
|
|
3326
|
-
const
|
|
3452
|
+
const model = buildTestModel(renderedMarkup(this.#testElement));
|
|
3453
|
+
this.#sectionItems = new Map(model.testParts.flatMap((part) => sectionsInOrder(part.sections).map((section) => [section.identifier, itemRefsInOrder(section.content).map((item) => item.identifier)])));
|
|
3454
|
+
this.#itemOrder = model.testParts.flatMap((part) => itemRefsInOrder(part.sections));
|
|
3327
3455
|
this.computedContext = {
|
|
3328
3456
|
itemElement: this.#itemElement,
|
|
3329
|
-
identifier:
|
|
3330
|
-
title:
|
|
3457
|
+
identifier: model.identifier,
|
|
3458
|
+
title: model.title,
|
|
3331
3459
|
view: this._sessionContext?.view,
|
|
3332
3460
|
plugins: this._sessionContext?.plugins ?? {},
|
|
3333
|
-
testParts:
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3461
|
+
testParts: model.testParts.map((testPart) => ({
|
|
3462
|
+
active: false,
|
|
3463
|
+
identifier: testPart.identifier,
|
|
3464
|
+
navigationMode: testPart.navigationMode,
|
|
3465
|
+
submissionMode: testPart.submissionMode,
|
|
3466
|
+
allowSkipping: testPart.sessionControl.allowSkipping,
|
|
3467
|
+
// Flat, depth first: every section once, each with only its own item-refs, so every item is
|
|
3468
|
+
// listed once. Where a section's item-refs and subsections interleave, this list is not in
|
|
3469
|
+
// document order; `index` is.
|
|
3470
|
+
sections: sectionsInOrder(testPart.sections).map((section) => ({
|
|
3341
3471
|
active: false,
|
|
3342
|
-
identifier:
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
};
|
|
3382
|
-
})
|
|
3472
|
+
identifier: section.identifier,
|
|
3473
|
+
title: section.title,
|
|
3474
|
+
// QTI defines both modes on the test part only; the section attributes go in roadmap T1d.
|
|
3475
|
+
...this.#sectionModes(section.identifier),
|
|
3476
|
+
allowSkipping: section.sessionControl.allowSkipping,
|
|
3477
|
+
items: ownItemRefs(section).map((item) => ({
|
|
3478
|
+
...this.initContext?.find((i) => i.identifier === item.identifier),
|
|
3479
|
+
active: false,
|
|
3480
|
+
identifier: item.identifier,
|
|
3481
|
+
categories: item.categories,
|
|
3482
|
+
href: item.href,
|
|
3483
|
+
variables: [],
|
|
3484
|
+
sessionControl: { ...item.sessionControl }
|
|
3485
|
+
}))
|
|
3486
|
+
}))
|
|
3487
|
+
}))
|
|
3488
|
+
};
|
|
3489
|
+
}
|
|
3490
|
+
/**
|
|
3491
|
+
* The item-refs of each section, its subsections' included, by section identifier: a section that
|
|
3492
|
+
* only holds subsections is completed when theirs are.
|
|
3493
|
+
*/
|
|
3494
|
+
#sectionItems;
|
|
3495
|
+
/** Every item-ref of the test in document order, which item numbers follow. */
|
|
3496
|
+
#itemOrder;
|
|
3497
|
+
/** Item numbers in document order, skipping info items; null for an info item. */
|
|
3498
|
+
#itemIndexes() {
|
|
3499
|
+
let index = 1;
|
|
3500
|
+
return new Map(this.#itemOrder.map((item) => [
|
|
3501
|
+
item.identifier,
|
|
3502
|
+
item.categories.includes(this.configContext?.infoItemCategory) ? null : index++
|
|
3503
|
+
]));
|
|
3504
|
+
}
|
|
3505
|
+
/** The non-QTI `navigation-mode` / `submission-mode` a section declares, as before; removed in T1d. */
|
|
3506
|
+
#sectionModes(identifier) {
|
|
3507
|
+
const section = this.#testElement.querySelector(`qti-assessment-section[identifier="${CSS.escape(identifier)}"]`);
|
|
3508
|
+
return {
|
|
3509
|
+
navigationMode: section?.getAttribute("navigation-mode") ?? void 0,
|
|
3510
|
+
submissionMode: section?.getAttribute("submission-mode") ?? void 0
|
|
3383
3511
|
};
|
|
3384
3512
|
}
|
|
3385
3513
|
/**
|
|
@@ -3468,7 +3596,7 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3468
3596
|
willUpdate(_changedProperties) {
|
|
3469
3597
|
if (!this.computedContext)
|
|
3470
3598
|
return;
|
|
3471
|
-
|
|
3599
|
+
const itemIndexes = this.#itemIndexes();
|
|
3472
3600
|
this.computedContext = {
|
|
3473
3601
|
...this.computedContext,
|
|
3474
3602
|
view: this._sessionContext?.view,
|
|
@@ -3481,7 +3609,7 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3481
3609
|
return {
|
|
3482
3610
|
...section,
|
|
3483
3611
|
active: this._sessionContext?.navSectionId === section.identifier || false,
|
|
3484
|
-
completed: section.items.every((
|
|
3612
|
+
completed: (this.#sectionItems.get(section.identifier) ?? section.items.map((i) => i.identifier)).every((identifier) => this._testContext.items.find((i) => i.identifier === identifier)?.variables.find((v) => v.identifier === "completionStatus")?.value === "completed"),
|
|
3485
3613
|
items: section.items.map((item) => {
|
|
3486
3614
|
const itemContext = this._testContext?.items.find((i) => i.identifier === item.identifier);
|
|
3487
3615
|
const computedItem = {
|
|
@@ -3527,7 +3655,7 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3527
3655
|
}
|
|
3528
3656
|
return v.value === defaultValue;
|
|
3529
3657
|
});
|
|
3530
|
-
const index =
|
|
3658
|
+
const index = itemIndexes.get(item.identifier) ?? null;
|
|
3531
3659
|
const rawMaxScore = item.variables?.find((vr) => vr.identifier == "MAXSCORE")?.value;
|
|
3532
3660
|
const maxScore = rawMaxScore === void 0 || rawMaxScore === null ? null : parseFloat(rawMaxScore?.toString());
|
|
3533
3661
|
let optimality = this.#optimality.get(computedItem.identifier);
|
|
@@ -3536,7 +3664,7 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3536
3664
|
if (numAttempts > 0)
|
|
3537
3665
|
this.#optimality.set(computedItem.identifier, optimality);
|
|
3538
3666
|
}
|
|
3539
|
-
const done = this.#isItemDone(numAttempts, optimality, computedItem.maxAttempts, computedItem.adaptive, completionStatus);
|
|
3667
|
+
const done = this.#isItemDone(numAttempts, optimality, computedItem.sessionControl?.maxAttempts, computedItem.adaptive, completionStatus);
|
|
3540
3668
|
return {
|
|
3541
3669
|
...computedItem,
|
|
3542
3670
|
completionStatus,
|
|
@@ -3615,7 +3743,7 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3615
3743
|
return false;
|
|
3616
3744
|
if (item.adaptive || element.adaptive === "true")
|
|
3617
3745
|
return false;
|
|
3618
|
-
const maxAttempts = item.maxAttempts ?? 1;
|
|
3746
|
+
const maxAttempts = item.sessionControl?.maxAttempts ?? 1;
|
|
3619
3747
|
return maxAttempts > 0 && (item.numAttempts ?? 0) >= maxAttempts;
|
|
3620
3748
|
}
|
|
3621
3749
|
/**
|
|
@@ -3941,4 +4069,4 @@ export {
|
|
|
3941
4069
|
* Portions Copyright (c) 2013, the Dart project authors.
|
|
3942
4070
|
*)
|
|
3943
4071
|
*/
|
|
3944
|
-
//# sourceMappingURL=chunk-
|
|
4072
|
+
//# sourceMappingURL=chunk-ORQFZNJW.js.map
|