@citolab/qti-components 7.0.9-beta.0 → 7.0.9-beta.1
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/chunks/{chunk-GVU44M3E.js → chunk-DKMHSSEK.js} +7 -16
- package/cdn/chunks/{chunk-I3HQJPKA.js → chunk-EG3QNAM6.js} +76 -71
- package/cdn/chunks/{chunk-LCKLXCUP.js → chunk-I5J4YQIW.js} +7 -16
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +1 -1
- package/cdn/qti-components/index.js +1 -1
- package/cdn/qti-item/core/index.js +1 -1
- package/cdn/qti-test/components/index.js +1 -1
- package/cdn/qti-test/components/test-container.js +1 -1
- package/dist/chunks/{chunk-NPHDN2TQ.js → chunk-5E4OEZCA.js} +360 -70
- package/dist/chunks/chunk-5E4OEZCA.js.map +1 -0
- package/dist/chunks/{chunk-MDWBTFKL.js → chunk-BH5H7BSS.js} +8 -17
- package/dist/chunks/{chunk-MDWBTFKL.js.map → chunk-BH5H7BSS.js.map} +1 -1
- package/dist/chunks/{chunk-6MW3J6OM.js → chunk-QGPXAPBK.js} +8 -17
- package/dist/chunks/{chunk-6MW3J6OM.js.map → chunk-QGPXAPBK.js.map} +1 -1
- package/dist/exports/item.context.d.ts +1 -1
- package/dist/exports/qti-assessment-item.context.d.ts +1 -1
- package/dist/exports/qti-condition-expression.d.ts +1 -1
- package/dist/exports/qti-expression.d.ts +1 -1
- package/dist/exports/session.context.d.ts +3 -3
- package/dist/exports/test.context.d.ts +1 -1
- package/dist/exports/variables.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -3
- package/dist/item.css +7 -16
- package/dist/qti-components/index.d.ts +44 -26
- package/dist/qti-components/index.js +5 -1
- package/dist/qti-components-jsx.d.ts +32 -0
- package/dist/qti-item/core/index.js +1 -1
- package/dist/qti-loader/index.d.ts +2 -2
- package/dist/{qti-response-declaration-CyOeVboh.d.ts → qti-response-declaration-CESClJ3_.d.ts} +5 -1
- package/dist/qti-test/components/index.d.ts +3 -3
- package/dist/qti-test/components/index.js +1 -1
- package/dist/qti-test/components/test-container.js +1 -1
- package/dist/qti-test/components/test-navigation.d.ts +3 -3
- package/dist/qti-test/core/index.d.ts +4 -4
- package/dist/{qti-test-part-zX9tOUbA.d.ts → qti-test-part-BAM_WUTL.d.ts} +1 -1
- package/dist/{variables-cO3DzqJy.d.ts → variables-DNDfraER.d.ts} +14 -1
- package/dist/vscode.html-custom-data.json +16 -0
- package/package.json +1 -1
- package/cdn/chunks/chunk-KGVJXME7.js +0 -934
- package/dist/chunks/chunk-NPHDN2TQ.js.map +0 -1
|
@@ -2931,25 +2931,25 @@ var QtiGraphicOrderInteraction = class extends ChoicesMixin(Interaction, "qti-ho
|
|
|
2931
2931
|
setHotspotOrder(e) {
|
|
2932
2932
|
const { identifier } = e.detail;
|
|
2933
2933
|
const hotspot = this._choiceElements.find((el) => el.getAttribute("identifier") === identifier);
|
|
2934
|
+
if (!hotspot) return;
|
|
2934
2935
|
const maxSelection = this._choiceElements.length;
|
|
2935
2936
|
if (!this.choiceOrdering) {
|
|
2936
2937
|
this.choiceOrdering = true;
|
|
2937
2938
|
if (hotspot.order == null) {
|
|
2938
|
-
|
|
2939
|
+
const currentSelection = this._choiceElements.filter((i) => i.order != null).length;
|
|
2940
|
+
if (currentSelection >= maxSelection) {
|
|
2939
2941
|
this.choiceOrdering = false;
|
|
2940
2942
|
return;
|
|
2941
2943
|
}
|
|
2942
|
-
hotspot.order =
|
|
2943
|
-
this.choiceOrdering = false;
|
|
2944
|
-
return;
|
|
2944
|
+
hotspot.order = currentSelection + 1;
|
|
2945
2945
|
} else {
|
|
2946
|
+
const removedOrder = hotspot.order;
|
|
2947
|
+
hotspot.order = null;
|
|
2946
2948
|
this._choiceElements.forEach((hotspot2) => {
|
|
2947
|
-
if (hotspot2.order
|
|
2949
|
+
if (hotspot2.order != null && hotspot2.order > removedOrder) {
|
|
2948
2950
|
hotspot2.order--;
|
|
2949
2951
|
}
|
|
2950
|
-
return hotspot2;
|
|
2951
2952
|
});
|
|
2952
|
-
hotspot.order = null;
|
|
2953
2953
|
}
|
|
2954
2954
|
this.choiceOrdering = false;
|
|
2955
2955
|
}
|
|
@@ -3751,6 +3751,31 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
3751
3751
|
}
|
|
3752
3752
|
return null;
|
|
3753
3753
|
}
|
|
3754
|
+
addHyphenatedKeys(properties) {
|
|
3755
|
+
const updatedProperties = { ...properties };
|
|
3756
|
+
for (const key in properties) {
|
|
3757
|
+
if (Object.prototype.hasOwnProperty.call(properties, key)) {
|
|
3758
|
+
const hyphenatedKey = key.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);
|
|
3759
|
+
updatedProperties[hyphenatedKey] = properties[key];
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
return updatedProperties;
|
|
3763
|
+
}
|
|
3764
|
+
responseVariablesToQtiVariableJSON(input) {
|
|
3765
|
+
if (Array.isArray(input)) {
|
|
3766
|
+
return {
|
|
3767
|
+
list: {
|
|
3768
|
+
string: input
|
|
3769
|
+
}
|
|
3770
|
+
};
|
|
3771
|
+
} else {
|
|
3772
|
+
return {
|
|
3773
|
+
base: {
|
|
3774
|
+
string: input || ""
|
|
3775
|
+
}
|
|
3776
|
+
};
|
|
3777
|
+
}
|
|
3778
|
+
}
|
|
3754
3779
|
startChecking() {
|
|
3755
3780
|
this.intervalId = setInterval(() => {
|
|
3756
3781
|
const response = this.pci.getResponse();
|
|
@@ -3783,15 +3808,21 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
3783
3808
|
if (this.querySelector("properties")) {
|
|
3784
3809
|
this.querySelector("properties").style.display = "none";
|
|
3785
3810
|
}
|
|
3811
|
+
const jsonValue = this.responseVariablesToQtiVariableJSON(this.value);
|
|
3786
3812
|
const config = {
|
|
3787
|
-
properties: this.dataset,
|
|
3788
|
-
onready: () => {
|
|
3789
|
-
|
|
3790
|
-
}
|
|
3813
|
+
properties: this.addHyphenatedKeys({ ...this.dataset }),
|
|
3814
|
+
onready: (pciInstance) => {
|
|
3815
|
+
this.pci = pciInstance;
|
|
3816
|
+
},
|
|
3817
|
+
responseIdentifier: this.responseIdentifier,
|
|
3818
|
+
boundTo: jsonValue.base || jsonValue.list
|
|
3819
|
+
// TODO: implement the following properties:
|
|
3820
|
+
// templateVariables An object containing all of the template variables referenced (via qti-template-variable elements) in the qti-portable-custom-interaction and their current values.The values of variables MUST follow the structure defined in Appendix C.
|
|
3821
|
+
// contextVariables An object containing all of the context variables referenced (via qti-context-variable elements) in the qti-portable-custom-interaction and their current values. The values of variables MUST follow the structure defined in Appendix C.
|
|
3791
3822
|
};
|
|
3792
|
-
if (pci.getInstance)
|
|
3823
|
+
if (pci.getInstance) {
|
|
3793
3824
|
pci.getInstance(dom, config, void 0);
|
|
3794
|
-
else {
|
|
3825
|
+
} else {
|
|
3795
3826
|
const restoreTAOConfig = (element) => {
|
|
3796
3827
|
const config2 = {};
|
|
3797
3828
|
const parseDataAttributes = (element2) => {
|
|
@@ -5136,6 +5167,82 @@ import { property as property30 } from "lit/decorators.js";
|
|
|
5136
5167
|
|
|
5137
5168
|
// src/lib/qti-components/qti-response-processing/utilities/scoring-helper.ts
|
|
5138
5169
|
var ScoringHelper = class {
|
|
5170
|
+
/**
|
|
5171
|
+
* Checks if a given point is within a specified area.
|
|
5172
|
+
* @param point The point to test, represented as a string "x y" (e.g., "102 113").
|
|
5173
|
+
* @param areaKey The area definition, including shape and coordinates (e.g., "circle,102,113,16").
|
|
5174
|
+
* @param baseType The base type of the response, must be "point" for this method to proceed.
|
|
5175
|
+
* @returns True if the point is within the area; false otherwise.
|
|
5176
|
+
*/
|
|
5177
|
+
static isPointInArea(point, areaKey, baseType) {
|
|
5178
|
+
if (baseType !== "point") {
|
|
5179
|
+
console.warn(`Base type ${baseType} is not supported for point area mapping.`);
|
|
5180
|
+
return false;
|
|
5181
|
+
}
|
|
5182
|
+
const [px, py] = point.split(" ").map(Number);
|
|
5183
|
+
const [shape, ...coords] = areaKey.split(",");
|
|
5184
|
+
const coordinates = coords.map(Number);
|
|
5185
|
+
switch (shape.toLowerCase()) {
|
|
5186
|
+
case "circle":
|
|
5187
|
+
case "default": {
|
|
5188
|
+
const [cx, cy, radius] = coordinates;
|
|
5189
|
+
if (coordinates.length !== 3) {
|
|
5190
|
+
console.warn(`Invalid circle definition: ${areaKey}`);
|
|
5191
|
+
return false;
|
|
5192
|
+
}
|
|
5193
|
+
const distance = Math.sqrt((px - cx) ** 2 + (py - cy) ** 2);
|
|
5194
|
+
return distance <= radius;
|
|
5195
|
+
}
|
|
5196
|
+
case "rect": {
|
|
5197
|
+
const [x1, y1, x2, y2] = coordinates;
|
|
5198
|
+
if (coordinates.length !== 4) {
|
|
5199
|
+
console.warn(`Invalid rectangle definition: ${areaKey}`);
|
|
5200
|
+
return false;
|
|
5201
|
+
}
|
|
5202
|
+
return px >= x1 && px <= x2 && py >= y1 && py <= y2;
|
|
5203
|
+
}
|
|
5204
|
+
case "ellipse": {
|
|
5205
|
+
const [cx, cy, rx, ry] = coordinates;
|
|
5206
|
+
if (coordinates.length !== 4) {
|
|
5207
|
+
console.warn(`Invalid ellipse definition: ${areaKey}`);
|
|
5208
|
+
return false;
|
|
5209
|
+
}
|
|
5210
|
+
const normalizedX = (px - cx) ** 2 / rx ** 2;
|
|
5211
|
+
const normalizedY = (py - cy) ** 2 / ry ** 2;
|
|
5212
|
+
return normalizedX + normalizedY <= 1;
|
|
5213
|
+
}
|
|
5214
|
+
case "poly": {
|
|
5215
|
+
if (coordinates.length < 6 || coordinates.length % 2 !== 0) {
|
|
5216
|
+
console.warn(`Invalid polygon definition: ${areaKey}`);
|
|
5217
|
+
return false;
|
|
5218
|
+
}
|
|
5219
|
+
const vertices = [];
|
|
5220
|
+
for (let i = 0; i < coordinates.length; i += 2) {
|
|
5221
|
+
vertices.push({ x: coordinates[i], y: coordinates[i + 1] });
|
|
5222
|
+
}
|
|
5223
|
+
return this.isPointInPolygon({ x: px, y: py }, vertices);
|
|
5224
|
+
}
|
|
5225
|
+
default:
|
|
5226
|
+
console.warn(`Unsupported shape type: ${shape}`);
|
|
5227
|
+
return false;
|
|
5228
|
+
}
|
|
5229
|
+
}
|
|
5230
|
+
/**
|
|
5231
|
+
* Checks if a point is inside a polygon using the ray-casting algorithm.
|
|
5232
|
+
* @param point The point to test.
|
|
5233
|
+
* @param vertices The vertices of the polygon in order (array of {x, y} objects).
|
|
5234
|
+
* @returns True if the point is inside the polygon; false otherwise.
|
|
5235
|
+
*/
|
|
5236
|
+
static isPointInPolygon(point, vertices) {
|
|
5237
|
+
let inside = false;
|
|
5238
|
+
for (let i = 0, j = vertices.length - 1; i < vertices.length; j = i++) {
|
|
5239
|
+
const xi = vertices[i].x, yi = vertices[i].y;
|
|
5240
|
+
const xj = vertices[j].x, yj = vertices[j].y;
|
|
5241
|
+
const intersect = yi > point.y !== yj > point.y && point.x < (xj - xi) * (point.y - yi) / (yj - yi) + xi;
|
|
5242
|
+
if (intersect) inside = !inside;
|
|
5243
|
+
}
|
|
5244
|
+
return inside;
|
|
5245
|
+
}
|
|
5139
5246
|
static compareSingleValues(value1, value2, baseType) {
|
|
5140
5247
|
switch (baseType) {
|
|
5141
5248
|
case "identifier":
|
|
@@ -5342,10 +5449,157 @@ __decorateClass([
|
|
|
5342
5449
|
], QtiMapResponse.prototype, "identifier", 2);
|
|
5343
5450
|
customElements.define("qti-map-response", QtiMapResponse);
|
|
5344
5451
|
|
|
5345
|
-
// src/lib/qti-components/qti-response-processing/qti-expression/qti-
|
|
5452
|
+
// src/lib/qti-components/qti-response-processing/qti-expression/qti-map-response-point/qti-map-response-point.ts
|
|
5346
5453
|
import { property as property32 } from "lit/decorators.js";
|
|
5347
|
-
|
|
5348
|
-
|
|
5454
|
+
|
|
5455
|
+
// src/lib/qti-components/internal/qti-expression.ts
|
|
5456
|
+
import { consume as consume3 } from "@lit/context";
|
|
5457
|
+
import { css as css34, html as html44, LitElement as LitElement25 } from "lit";
|
|
5458
|
+
import { state as state13 } from "lit/decorators.js";
|
|
5459
|
+
var QtiExpression2 = class extends LitElement25 {
|
|
5460
|
+
constructor() {
|
|
5461
|
+
super(...arguments);
|
|
5462
|
+
this.getVariables = () => (
|
|
5463
|
+
// FIXME: if this itself is multiple, this will never enter the qti-multiple switch
|
|
5464
|
+
// See this example here: https://github.com/1EdTech/qti-examples/blob/master/qtiv3-examples/packaging/items/Example05-feedbackBlock-adaptive.xml
|
|
5465
|
+
Array.from(this.children).map((e) => {
|
|
5466
|
+
switch (e.tagName.toLowerCase()) {
|
|
5467
|
+
case "qti-base-value": {
|
|
5468
|
+
return {
|
|
5469
|
+
baseType: e.getAttribute("base-type"),
|
|
5470
|
+
value: e.textContent.trim(),
|
|
5471
|
+
cardinality: "single"
|
|
5472
|
+
};
|
|
5473
|
+
}
|
|
5474
|
+
case "qti-variable": {
|
|
5475
|
+
const identifier = e.getAttribute("identifier") || "";
|
|
5476
|
+
const variable = this.context.variables.find((v) => v.identifier === identifier) || null;
|
|
5477
|
+
return variable;
|
|
5478
|
+
}
|
|
5479
|
+
case "qti-multiple": {
|
|
5480
|
+
const multiple = e;
|
|
5481
|
+
const values = multiple.getResult();
|
|
5482
|
+
if (values.length > 0) {
|
|
5483
|
+
return {
|
|
5484
|
+
identifier: "",
|
|
5485
|
+
baseType: values[0].baseType,
|
|
5486
|
+
value: values.map((v) => v.value),
|
|
5487
|
+
cardinality: "multiple",
|
|
5488
|
+
type: "response"
|
|
5489
|
+
};
|
|
5490
|
+
}
|
|
5491
|
+
return null;
|
|
5492
|
+
}
|
|
5493
|
+
case "qti-correct": {
|
|
5494
|
+
const identifier = e.getAttribute("identifier") || "";
|
|
5495
|
+
const responseVariable = this.context.variables.find((v) => v.identifier === identifier) || null;
|
|
5496
|
+
return {
|
|
5497
|
+
baseType: responseVariable.baseType,
|
|
5498
|
+
value: responseVariable.correctResponse,
|
|
5499
|
+
cardinality: responseVariable.cardinality
|
|
5500
|
+
};
|
|
5501
|
+
}
|
|
5502
|
+
default: {
|
|
5503
|
+
try {
|
|
5504
|
+
const expression = e;
|
|
5505
|
+
const value = expression.getResult();
|
|
5506
|
+
return {
|
|
5507
|
+
baseType: "integer",
|
|
5508
|
+
value: value.toString(),
|
|
5509
|
+
cardinality: "single"
|
|
5510
|
+
};
|
|
5511
|
+
} catch (error) {
|
|
5512
|
+
console.warn("default not sufficient");
|
|
5513
|
+
}
|
|
5514
|
+
return null;
|
|
5515
|
+
}
|
|
5516
|
+
}
|
|
5517
|
+
}).filter((v) => v !== null)
|
|
5518
|
+
);
|
|
5519
|
+
}
|
|
5520
|
+
render() {
|
|
5521
|
+
return html44`<pre>${JSON.stringify(this.result, null, 2)}</pre>
|
|
5522
|
+
<slot></slot>`;
|
|
5523
|
+
}
|
|
5524
|
+
calculate() {
|
|
5525
|
+
this.result = this.getResult();
|
|
5526
|
+
return this.result;
|
|
5527
|
+
}
|
|
5528
|
+
getResult() {
|
|
5529
|
+
throw new Error("Not implemented");
|
|
5530
|
+
}
|
|
5531
|
+
};
|
|
5532
|
+
// hide the slot with css
|
|
5533
|
+
QtiExpression2.styles = css34`
|
|
5534
|
+
slot {
|
|
5535
|
+
display: none;
|
|
5536
|
+
}
|
|
5537
|
+
`;
|
|
5538
|
+
__decorateClass([
|
|
5539
|
+
state13()
|
|
5540
|
+
], QtiExpression2.prototype, "result", 2);
|
|
5541
|
+
__decorateClass([
|
|
5542
|
+
consume3({ context: itemContext, subscribe: true }),
|
|
5543
|
+
state13()
|
|
5544
|
+
], QtiExpression2.prototype, "context", 2);
|
|
5545
|
+
|
|
5546
|
+
// src/lib/qti-components/qti-response-processing/qti-expression/qti-map-response-point/qti-map-response-point.ts
|
|
5547
|
+
var QtiMapResponsePoint = class extends QtiExpression2 {
|
|
5548
|
+
getResult() {
|
|
5549
|
+
const response = this.context.variables.find((r) => r.identifier === this.identifier);
|
|
5550
|
+
if (!response) {
|
|
5551
|
+
console.warn(`Response ${this.identifier} cannot be found`);
|
|
5552
|
+
return null;
|
|
5553
|
+
}
|
|
5554
|
+
const areaMapping = response.areaMapping;
|
|
5555
|
+
if (!areaMapping) {
|
|
5556
|
+
console.warn(`Area mapping not found for response ${this.identifier}`);
|
|
5557
|
+
return null;
|
|
5558
|
+
}
|
|
5559
|
+
const candidateResponses = !Array.isArray(response.value) ? [response.value] : response.value;
|
|
5560
|
+
if (!candidateResponses || candidateResponses.length === 0) {
|
|
5561
|
+
console.warn(`No candidate responses for response ${this.identifier}`);
|
|
5562
|
+
return null;
|
|
5563
|
+
}
|
|
5564
|
+
let result = 0;
|
|
5565
|
+
const mappedAreas = /* @__PURE__ */ new Set();
|
|
5566
|
+
for (const candidateResponse of candidateResponses) {
|
|
5567
|
+
for (const entry of areaMapping.mapEntries) {
|
|
5568
|
+
if (mappedAreas.has(entry.coords)) {
|
|
5569
|
+
continue;
|
|
5570
|
+
}
|
|
5571
|
+
const isPointInArea = ScoringHelper.isPointInArea(
|
|
5572
|
+
candidateResponse,
|
|
5573
|
+
`${entry.shape},${entry.coords}`,
|
|
5574
|
+
response.baseType
|
|
5575
|
+
);
|
|
5576
|
+
if (isPointInArea) {
|
|
5577
|
+
result += entry.mappedValue ?? 0;
|
|
5578
|
+
mappedAreas.add(entry.coords);
|
|
5579
|
+
}
|
|
5580
|
+
}
|
|
5581
|
+
}
|
|
5582
|
+
if (mappedAreas.size < candidateResponses.length) {
|
|
5583
|
+
result += areaMapping.defaultValue;
|
|
5584
|
+
}
|
|
5585
|
+
if (areaMapping.lowerBound != null) {
|
|
5586
|
+
result = Math.max(areaMapping.lowerBound, result);
|
|
5587
|
+
}
|
|
5588
|
+
if (areaMapping.upperBound != null) {
|
|
5589
|
+
result = Math.min(areaMapping.upperBound, result);
|
|
5590
|
+
}
|
|
5591
|
+
return result;
|
|
5592
|
+
}
|
|
5593
|
+
};
|
|
5594
|
+
__decorateClass([
|
|
5595
|
+
property32({ type: String })
|
|
5596
|
+
], QtiMapResponsePoint.prototype, "identifier", 2);
|
|
5597
|
+
customElements.define("qti-map-response-point", QtiMapResponsePoint);
|
|
5598
|
+
|
|
5599
|
+
// src/lib/qti-components/qti-response-processing/qti-expression/qti-mapping/qti-mapping.ts
|
|
5600
|
+
import { property as property33 } from "lit/decorators.js";
|
|
5601
|
+
import { LitElement as LitElement26 } from "lit";
|
|
5602
|
+
var QtiMapping = class extends LitElement26 {
|
|
5349
5603
|
constructor() {
|
|
5350
5604
|
super(...arguments);
|
|
5351
5605
|
this.defaultValue = 0;
|
|
@@ -5360,16 +5614,46 @@ var QtiMapping = class extends LitElement25 {
|
|
|
5360
5614
|
}
|
|
5361
5615
|
};
|
|
5362
5616
|
__decorateClass([
|
|
5363
|
-
|
|
5617
|
+
property33({ attribute: "default-value", type: Number })
|
|
5364
5618
|
], QtiMapping.prototype, "defaultValue", 2);
|
|
5365
5619
|
__decorateClass([
|
|
5366
|
-
|
|
5620
|
+
property33({ attribute: "lower-bound", type: Number })
|
|
5367
5621
|
], QtiMapping.prototype, "lowerBound", 2);
|
|
5368
5622
|
__decorateClass([
|
|
5369
|
-
|
|
5623
|
+
property33({ attribute: "upper-bound", type: Number })
|
|
5370
5624
|
], QtiMapping.prototype, "upperBound", 2);
|
|
5371
5625
|
customElements.define("qti-mapping", QtiMapping);
|
|
5372
5626
|
|
|
5627
|
+
// src/lib/qti-components/qti-response-processing/qti-expression/qti-area-mapping/qti-area-mapping.ts
|
|
5628
|
+
import { property as property34 } from "lit/decorators.js";
|
|
5629
|
+
import { LitElement as LitElement27 } from "lit";
|
|
5630
|
+
var QtiAreaMapping = class extends LitElement27 {
|
|
5631
|
+
constructor() {
|
|
5632
|
+
super(...arguments);
|
|
5633
|
+
this.defaultValue = 0;
|
|
5634
|
+
}
|
|
5635
|
+
get mapEntries() {
|
|
5636
|
+
return Array.from(this.querySelectorAll("qti-area-map-entry")).map((el) => {
|
|
5637
|
+
return {
|
|
5638
|
+
shape: el.getAttribute("shape"),
|
|
5639
|
+
coords: el.getAttribute("coords"),
|
|
5640
|
+
mappedValue: +el.getAttribute("mapped-value"),
|
|
5641
|
+
defaultValue: el.getAttribute("default-value") ? +el.getAttribute("default-value") : 0
|
|
5642
|
+
};
|
|
5643
|
+
});
|
|
5644
|
+
}
|
|
5645
|
+
};
|
|
5646
|
+
__decorateClass([
|
|
5647
|
+
property34({ attribute: "default-value", type: Number })
|
|
5648
|
+
], QtiAreaMapping.prototype, "defaultValue", 2);
|
|
5649
|
+
__decorateClass([
|
|
5650
|
+
property34({ attribute: "lower-bound", type: Number })
|
|
5651
|
+
], QtiAreaMapping.prototype, "lowerBound", 2);
|
|
5652
|
+
__decorateClass([
|
|
5653
|
+
property34({ attribute: "upper-bound", type: Number })
|
|
5654
|
+
], QtiAreaMapping.prototype, "upperBound", 2);
|
|
5655
|
+
customElements.define("qti-area-mapping", QtiAreaMapping);
|
|
5656
|
+
|
|
5373
5657
|
// src/lib/qti-components/qti-response-processing/qti-expression/qti-match/qti-match.ts
|
|
5374
5658
|
var QtiMatch = class _QtiMatch extends QtiExpression {
|
|
5375
5659
|
//PK : FIXME.
|
|
@@ -5509,10 +5793,10 @@ var QtiMultiple = class extends QtiExpression {
|
|
|
5509
5793
|
customElements.define("qti-multiple", QtiMultiple);
|
|
5510
5794
|
|
|
5511
5795
|
// src/lib/qti-components/qti-response-processing/qti-expression/qti-not/qti-not.ts
|
|
5512
|
-
import { html as
|
|
5796
|
+
import { html as html45 } from "lit";
|
|
5513
5797
|
var QtiNot = class extends QtiExpression {
|
|
5514
5798
|
render() {
|
|
5515
|
-
return
|
|
5799
|
+
return html45`${super.render()}`;
|
|
5516
5800
|
}
|
|
5517
5801
|
getResult() {
|
|
5518
5802
|
const expression = this.firstElementChild;
|
|
@@ -5576,13 +5860,13 @@ var QtiOrdered = class extends QtiExpression {
|
|
|
5576
5860
|
customElements.define("qti-ordered", QtiOrdered);
|
|
5577
5861
|
|
|
5578
5862
|
// src/lib/qti-components/qti-response-processing/qti-expression/qti-printed-variable/qti-printed-variable.ts
|
|
5579
|
-
import { consume as
|
|
5580
|
-
import { LitElement as
|
|
5581
|
-
import { property as
|
|
5582
|
-
var QtiPrintedVariable = class extends
|
|
5863
|
+
import { consume as consume4 } from "@lit/context";
|
|
5864
|
+
import { LitElement as LitElement28, html as html46 } from "lit";
|
|
5865
|
+
import { property as property35, state as state14 } from "lit/decorators.js";
|
|
5866
|
+
var QtiPrintedVariable = class extends LitElement28 {
|
|
5583
5867
|
render() {
|
|
5584
5868
|
const value = this.context?.variables.find((v) => v.identifier === this.identifier)?.value;
|
|
5585
|
-
return
|
|
5869
|
+
return html46`${JSON.stringify(value, null, 2)}`;
|
|
5586
5870
|
}
|
|
5587
5871
|
calculate() {
|
|
5588
5872
|
const result = this.context.variables.find((v) => v.identifier === this.identifier) || null;
|
|
@@ -5590,11 +5874,11 @@ var QtiPrintedVariable = class extends LitElement26 {
|
|
|
5590
5874
|
}
|
|
5591
5875
|
};
|
|
5592
5876
|
__decorateClass([
|
|
5593
|
-
|
|
5877
|
+
property35({ type: String })
|
|
5594
5878
|
], QtiPrintedVariable.prototype, "identifier", 2);
|
|
5595
5879
|
__decorateClass([
|
|
5596
|
-
|
|
5597
|
-
|
|
5880
|
+
consume4({ context: itemContext, subscribe: true }),
|
|
5881
|
+
state14()
|
|
5598
5882
|
], QtiPrintedVariable.prototype, "context", 2);
|
|
5599
5883
|
customElements.define("qti-printed-variable", QtiPrintedVariable);
|
|
5600
5884
|
|
|
@@ -5654,7 +5938,7 @@ function qtiSubtractMixin(Base) {
|
|
|
5654
5938
|
customElements.define("qti-subtract", QtiSubtract);
|
|
5655
5939
|
|
|
5656
5940
|
// src/lib/qti-components/qti-response-processing/qti-expression/qti-string-match/qti-string-match.ts
|
|
5657
|
-
import { property as
|
|
5941
|
+
import { property as property36 } from "lit/decorators.js";
|
|
5658
5942
|
var QtiStringMatch = class extends QtiExpression {
|
|
5659
5943
|
constructor() {
|
|
5660
5944
|
super(...arguments);
|
|
@@ -5678,7 +5962,7 @@ var QtiStringMatch = class extends QtiExpression {
|
|
|
5678
5962
|
}
|
|
5679
5963
|
};
|
|
5680
5964
|
__decorateClass([
|
|
5681
|
-
|
|
5965
|
+
property36({ type: String, attribute: "case-sensitive" })
|
|
5682
5966
|
], QtiStringMatch.prototype, "caseSensitive", 2);
|
|
5683
5967
|
customElements.define("qti-string-match", QtiStringMatch);
|
|
5684
5968
|
|
|
@@ -5726,11 +6010,11 @@ var QtiVariable = class extends QtiExpression {
|
|
|
5726
6010
|
customElements.define("qti-variable", QtiVariable);
|
|
5727
6011
|
|
|
5728
6012
|
// src/lib/qti-components/qti-rubric-block/qti-content-body.ts
|
|
5729
|
-
import { LitElement as
|
|
6013
|
+
import { LitElement as LitElement29, html as html47 } from "lit";
|
|
5730
6014
|
import { customElement as customElement43 } from "lit/decorators.js";
|
|
5731
|
-
var QtiContentBody = class extends
|
|
6015
|
+
var QtiContentBody = class extends LitElement29 {
|
|
5732
6016
|
render() {
|
|
5733
|
-
return
|
|
6017
|
+
return html47`<slot></slot>`;
|
|
5734
6018
|
}
|
|
5735
6019
|
};
|
|
5736
6020
|
QtiContentBody = __decorateClass([
|
|
@@ -5738,9 +6022,9 @@ QtiContentBody = __decorateClass([
|
|
|
5738
6022
|
], QtiContentBody);
|
|
5739
6023
|
|
|
5740
6024
|
// src/lib/qti-components/qti-rubric-block/qti-rubric-block.ts
|
|
5741
|
-
import { LitElement as
|
|
5742
|
-
import { customElement as customElement44, property as
|
|
5743
|
-
var QtiRubricBlock = class extends
|
|
6025
|
+
import { LitElement as LitElement30, css as css35, html as html48 } from "lit";
|
|
6026
|
+
import { customElement as customElement44, property as property37 } from "lit/decorators.js";
|
|
6027
|
+
var QtiRubricBlock = class extends LitElement30 {
|
|
5744
6028
|
handleclassNamesChange() {
|
|
5745
6029
|
const classNames = this.classNames.split(" ");
|
|
5746
6030
|
classNames.forEach((className) => {
|
|
@@ -5757,29 +6041,29 @@ var QtiRubricBlock = class extends LitElement28 {
|
|
|
5757
6041
|
});
|
|
5758
6042
|
}
|
|
5759
6043
|
render() {
|
|
5760
|
-
return
|
|
6044
|
+
return html48`<slot></slot>`;
|
|
5761
6045
|
}
|
|
5762
6046
|
connectedCallback() {
|
|
5763
6047
|
super.connectedCallback();
|
|
5764
6048
|
this.setAttribute("slot", "qti-rubric-block");
|
|
5765
6049
|
}
|
|
5766
6050
|
};
|
|
5767
|
-
QtiRubricBlock.styles =
|
|
6051
|
+
QtiRubricBlock.styles = css35`
|
|
5768
6052
|
:host {
|
|
5769
6053
|
display: block;
|
|
5770
6054
|
}
|
|
5771
6055
|
`;
|
|
5772
6056
|
__decorateClass([
|
|
5773
|
-
|
|
6057
|
+
property37({ type: String })
|
|
5774
6058
|
], QtiRubricBlock.prototype, "id", 2);
|
|
5775
6059
|
__decorateClass([
|
|
5776
|
-
|
|
6060
|
+
property37({ type: String })
|
|
5777
6061
|
], QtiRubricBlock.prototype, "use", 2);
|
|
5778
6062
|
__decorateClass([
|
|
5779
|
-
|
|
6063
|
+
property37({ type: String })
|
|
5780
6064
|
], QtiRubricBlock.prototype, "view", 2);
|
|
5781
6065
|
__decorateClass([
|
|
5782
|
-
|
|
6066
|
+
property37({ type: String, attribute: "class" })
|
|
5783
6067
|
], QtiRubricBlock.prototype, "classNames", 2);
|
|
5784
6068
|
__decorateClass([
|
|
5785
6069
|
watch("classNames", { waitUntilFirstUpdate: true })
|
|
@@ -5789,9 +6073,9 @@ QtiRubricBlock = __decorateClass([
|
|
|
5789
6073
|
], QtiRubricBlock);
|
|
5790
6074
|
|
|
5791
6075
|
// src/lib/qti-components/qti-stylesheet/qti-stylesheet.ts
|
|
5792
|
-
import { LitElement as
|
|
6076
|
+
import { LitElement as LitElement31 } from "lit";
|
|
5793
6077
|
import { customElement as customElement45 } from "lit/decorators.js";
|
|
5794
|
-
var QtiStylesheet = class extends
|
|
6078
|
+
var QtiStylesheet = class extends LitElement31 {
|
|
5795
6079
|
constructor() {
|
|
5796
6080
|
super(...arguments);
|
|
5797
6081
|
this.styleElement = null;
|
|
@@ -5845,16 +6129,16 @@ QtiStylesheet = __decorateClass([
|
|
|
5845
6129
|
], QtiStylesheet);
|
|
5846
6130
|
|
|
5847
6131
|
// src/lib/qti-components/qti-variable-declaration/qti-outcome-declaration/qti-outcome-declaration.ts
|
|
5848
|
-
import { consume as
|
|
5849
|
-
import { css as
|
|
5850
|
-
import { customElement as customElement47, property as
|
|
6132
|
+
import { consume as consume5 } from "@lit/context";
|
|
6133
|
+
import { css as css36, html as html50 } from "lit";
|
|
6134
|
+
import { customElement as customElement47, property as property38, state as state15 } from "lit/decorators.js";
|
|
5851
6135
|
|
|
5852
6136
|
// src/lib/qti-components/qti-variable-declaration/qti-variable-declaration.ts
|
|
5853
|
-
import { html as
|
|
6137
|
+
import { html as html49, LitElement as LitElement32 } from "lit";
|
|
5854
6138
|
import { customElement as customElement46 } from "lit/decorators.js";
|
|
5855
|
-
var QtiVariableDeclaration = class extends
|
|
6139
|
+
var QtiVariableDeclaration = class extends LitElement32 {
|
|
5856
6140
|
render() {
|
|
5857
|
-
return
|
|
6141
|
+
return html49`<slot></slot>`;
|
|
5858
6142
|
}
|
|
5859
6143
|
defaultValues(variable) {
|
|
5860
6144
|
const htmlValues = Array.from(this.querySelectorAll("qti-default-value > qti-value"));
|
|
@@ -5880,7 +6164,7 @@ var QtiOutcomeDeclaration = class extends QtiVariableDeclaration {
|
|
|
5880
6164
|
}
|
|
5881
6165
|
render() {
|
|
5882
6166
|
const value = this.itemContext?.variables.find((v) => v.identifier === this.identifier)?.value;
|
|
5883
|
-
return
|
|
6167
|
+
return html50`${JSON.stringify(value, null, 2)}`;
|
|
5884
6168
|
}
|
|
5885
6169
|
get interpolationTable() {
|
|
5886
6170
|
const table = this.querySelector("qti-interpolation-table");
|
|
@@ -5923,40 +6207,40 @@ var QtiOutcomeDeclaration = class extends QtiVariableDeclaration {
|
|
|
5923
6207
|
}
|
|
5924
6208
|
};
|
|
5925
6209
|
QtiOutcomeDeclaration.styles = [
|
|
5926
|
-
|
|
6210
|
+
css36`
|
|
5927
6211
|
:host {
|
|
5928
6212
|
display: none;
|
|
5929
6213
|
}
|
|
5930
6214
|
`
|
|
5931
6215
|
];
|
|
5932
6216
|
__decorateClass([
|
|
5933
|
-
|
|
6217
|
+
property38({ type: String, attribute: "base-type" })
|
|
5934
6218
|
], QtiOutcomeDeclaration.prototype, "baseType", 2);
|
|
5935
6219
|
__decorateClass([
|
|
5936
|
-
|
|
6220
|
+
property38({ type: String, attribute: "external-scored" })
|
|
5937
6221
|
], QtiOutcomeDeclaration.prototype, "externalScored", 2);
|
|
5938
6222
|
__decorateClass([
|
|
5939
|
-
|
|
6223
|
+
property38({ type: String })
|
|
5940
6224
|
], QtiOutcomeDeclaration.prototype, "identifier", 2);
|
|
5941
6225
|
__decorateClass([
|
|
5942
|
-
|
|
6226
|
+
property38({ type: String })
|
|
5943
6227
|
], QtiOutcomeDeclaration.prototype, "cardinality", 2);
|
|
5944
6228
|
__decorateClass([
|
|
5945
|
-
|
|
5946
|
-
|
|
6229
|
+
consume5({ context: itemContext, subscribe: true }),
|
|
6230
|
+
state15()
|
|
5947
6231
|
], QtiOutcomeDeclaration.prototype, "itemContext", 2);
|
|
5948
6232
|
QtiOutcomeDeclaration = __decorateClass([
|
|
5949
6233
|
customElement47("qti-outcome-declaration")
|
|
5950
6234
|
], QtiOutcomeDeclaration);
|
|
5951
6235
|
|
|
5952
6236
|
// src/lib/qti-components/qti-variable-declaration/qti-response-declaration/qti-response-declaration.ts
|
|
5953
|
-
import { consume as
|
|
5954
|
-
import { css as
|
|
5955
|
-
import { customElement as customElement48, property as
|
|
6237
|
+
import { consume as consume6 } from "@lit/context";
|
|
6238
|
+
import { css as css37, html as html51 } from "lit";
|
|
6239
|
+
import { customElement as customElement48, property as property39, state as state16 } from "lit/decorators.js";
|
|
5956
6240
|
var QtiResponseDeclaration = class extends QtiVariableDeclaration {
|
|
5957
6241
|
render() {
|
|
5958
6242
|
const value = this.itemContext?.variables.find((v) => v.identifier === this.identifier)?.value;
|
|
5959
|
-
return
|
|
6243
|
+
return html51`${JSON.stringify(value, null, 2)}`;
|
|
5960
6244
|
}
|
|
5961
6245
|
connectedCallback() {
|
|
5962
6246
|
super.connectedCallback();
|
|
@@ -5966,6 +6250,7 @@ var QtiResponseDeclaration = class extends QtiVariableDeclaration {
|
|
|
5966
6250
|
correctResponse: this.correctResponse,
|
|
5967
6251
|
cardinality: this.cardinality || "single",
|
|
5968
6252
|
mapping: this.mapping,
|
|
6253
|
+
areaMapping: this.areaMapping,
|
|
5969
6254
|
value: null,
|
|
5970
6255
|
type: "response",
|
|
5971
6256
|
candidateResponse: null
|
|
@@ -6000,26 +6285,29 @@ var QtiResponseDeclaration = class extends QtiVariableDeclaration {
|
|
|
6000
6285
|
get mapping() {
|
|
6001
6286
|
return this.querySelector("qti-mapping");
|
|
6002
6287
|
}
|
|
6288
|
+
get areaMapping() {
|
|
6289
|
+
return this.querySelector("qti-area-mapping");
|
|
6290
|
+
}
|
|
6003
6291
|
};
|
|
6004
6292
|
QtiResponseDeclaration.styles = [
|
|
6005
|
-
|
|
6293
|
+
css37`
|
|
6006
6294
|
:host {
|
|
6007
6295
|
display: none;
|
|
6008
6296
|
}
|
|
6009
6297
|
`
|
|
6010
6298
|
];
|
|
6011
6299
|
__decorateClass([
|
|
6012
|
-
|
|
6300
|
+
property39({ type: String, attribute: "base-type" })
|
|
6013
6301
|
], QtiResponseDeclaration.prototype, "baseType", 2);
|
|
6014
6302
|
__decorateClass([
|
|
6015
|
-
|
|
6303
|
+
property39({ type: String })
|
|
6016
6304
|
], QtiResponseDeclaration.prototype, "identifier", 2);
|
|
6017
6305
|
__decorateClass([
|
|
6018
|
-
|
|
6306
|
+
property39({ type: String })
|
|
6019
6307
|
], QtiResponseDeclaration.prototype, "cardinality", 2);
|
|
6020
6308
|
__decorateClass([
|
|
6021
|
-
|
|
6022
|
-
|
|
6309
|
+
consume6({ context: itemContext, subscribe: true }),
|
|
6310
|
+
state16()
|
|
6023
6311
|
], QtiResponseDeclaration.prototype, "itemContext", 2);
|
|
6024
6312
|
QtiResponseDeclaration = __decorateClass([
|
|
6025
6313
|
customElement48("qti-response-declaration")
|
|
@@ -6090,7 +6378,9 @@ export {
|
|
|
6090
6378
|
QtiLt,
|
|
6091
6379
|
QtiLte,
|
|
6092
6380
|
QtiMapResponse,
|
|
6381
|
+
QtiMapResponsePoint,
|
|
6093
6382
|
QtiMapping,
|
|
6383
|
+
QtiAreaMapping,
|
|
6094
6384
|
QtiMatch,
|
|
6095
6385
|
QtiMember,
|
|
6096
6386
|
QtiMultiple,
|
|
@@ -6111,4 +6401,4 @@ export {
|
|
|
6111
6401
|
QtiOutcomeDeclaration,
|
|
6112
6402
|
QtiResponseDeclaration
|
|
6113
6403
|
};
|
|
6114
|
-
//# sourceMappingURL=chunk-
|
|
6404
|
+
//# sourceMappingURL=chunk-5E4OEZCA.js.map
|