@citolab/qti-components 7.14.3 → 7.15.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/cdn/index.global.js +1 -1
- package/cdn/index.js +4044 -4030
- package/custom-elements.json +10478 -26460
- package/dist/base.d.ts +8 -0
- package/dist/base.js +50 -0
- package/dist/{chunks/chunk-DGBI4IU5.js → chunk-2DOYPVF5.js} +252 -136
- package/dist/chunk-2DOYPVF5.js.map +1 -0
- package/dist/chunk-2ZEJ3RR5.js +89 -0
- package/dist/chunk-2ZEJ3RR5.js.map +1 -0
- package/dist/{chunks/chunk-E4GR4K26.js → chunk-352OTVTY.js} +1481 -442
- package/dist/chunk-352OTVTY.js.map +1 -0
- package/dist/{chunks/chunk-C4ELTNV7.js → chunk-C2HQFI2C.js} +857 -3819
- package/dist/chunk-C2HQFI2C.js.map +1 -0
- package/dist/chunk-DWIRLYDS.js +20 -0
- package/dist/chunk-DWIRLYDS.js.map +1 -0
- package/dist/{chunks/chunk-H2JE6IVU.js → chunk-EUXUH3YW.js} +1 -1
- package/dist/chunk-F44CI35W.js +145 -0
- package/dist/chunk-F44CI35W.js.map +1 -0
- package/dist/{chunks/chunk-XBPO6E25.js → chunk-INKI27D5.js} +6 -5
- package/dist/chunk-INKI27D5.js.map +1 -0
- package/dist/chunk-JEUY3MYB.js +2010 -0
- package/dist/chunk-JEUY3MYB.js.map +1 -0
- package/dist/chunk-O4XIWHTF.js +1139 -0
- package/dist/chunk-O4XIWHTF.js.map +1 -0
- package/dist/chunk-RI47B4ZT.js +1753 -0
- package/dist/chunk-RI47B4ZT.js.map +1 -0
- package/dist/{qti-loader/index.js → chunk-VEV4DGPH.js} +6 -6
- package/dist/chunk-VEV4DGPH.js.map +1 -0
- package/dist/{chunks/chunk-TN75CWLX.js → chunk-W4SQRNWO.js} +97 -2
- package/dist/chunk-W4SQRNWO.js.map +1 -0
- package/dist/elements.d.ts +1 -0
- package/dist/elements.js +42 -0
- package/dist/index.d.ts +8 -24
- package/dist/index.js +117 -285
- package/dist/index.js.map +1 -1
- package/dist/interactions.d.ts +1 -0
- package/dist/interactions.js +72 -0
- package/dist/item.d.ts +1 -0
- package/dist/item.js +23 -0
- package/dist/loader.d.ts +1 -0
- package/dist/loader.js +11 -0
- package/dist/processing.d.ts +1 -0
- package/dist/processing.js +103 -0
- package/dist/qti-components-jsx.d.ts +1475 -2388
- package/dist/test.d.ts +1 -0
- package/dist/{qti-test/index.js → test.js} +11 -19
- package/dist/transformers.d.ts +1 -0
- package/dist/{qti-transformers/index.js → transformers.js} +3 -3
- package/dist/vscode.html-custom-data.json +469 -631
- package/package.json +70 -166
- package/LICENSE.md +0 -674
- package/dist/chunks/chunk-4OGJBG35.js +0 -8
- package/dist/chunks/chunk-4OGJBG35.js.map +0 -1
- package/dist/chunks/chunk-AGV5GOTF.js +0 -234
- package/dist/chunks/chunk-AGV5GOTF.js.map +0 -1
- package/dist/chunks/chunk-BHJSX3Q6.js +0 -8
- package/dist/chunks/chunk-BHJSX3Q6.js.map +0 -1
- package/dist/chunks/chunk-C4ELTNV7.js.map +0 -1
- package/dist/chunks/chunk-C5RLRG3L.js +0 -10
- package/dist/chunks/chunk-C5RLRG3L.js.map +0 -1
- package/dist/chunks/chunk-CJADUWEC.js +0 -10
- package/dist/chunks/chunk-CJADUWEC.js.map +0 -1
- package/dist/chunks/chunk-DGBI4IU5.js.map +0 -1
- package/dist/chunks/chunk-DVQQ7I6Y.js +0 -8
- package/dist/chunks/chunk-DVQQ7I6Y.js.map +0 -1
- package/dist/chunks/chunk-E4GR4K26.js.map +0 -1
- package/dist/chunks/chunk-ELDMXTUQ.js +0 -31
- package/dist/chunks/chunk-ELDMXTUQ.js.map +0 -1
- package/dist/chunks/chunk-GAAFN7QF.js +0 -146
- package/dist/chunks/chunk-GAAFN7QF.js.map +0 -1
- package/dist/chunks/chunk-H6KHXSIO.js +0 -8
- package/dist/chunks/chunk-H6KHXSIO.js.map +0 -1
- package/dist/chunks/chunk-JQ6HWGRY.js +0 -22
- package/dist/chunks/chunk-JQ6HWGRY.js.map +0 -1
- package/dist/chunks/chunk-NJNQOQUU.js +0 -8
- package/dist/chunks/chunk-NJNQOQUU.js.map +0 -1
- package/dist/chunks/chunk-P4QBOVQ2.js +0 -206
- package/dist/chunks/chunk-P4QBOVQ2.js.map +0 -1
- package/dist/chunks/chunk-SV4K25ZI.js +0 -19
- package/dist/chunks/chunk-SV4K25ZI.js.map +0 -1
- package/dist/chunks/chunk-TN75CWLX.js.map +0 -1
- package/dist/chunks/chunk-XBPO6E25.js.map +0 -1
- package/dist/exports/computed-item.context.d.ts +0 -23
- package/dist/exports/computed-item.context.js +0 -8
- package/dist/exports/computed.context.d.ts +0 -34
- package/dist/exports/computed.context.js +0 -8
- package/dist/exports/config.context.d.ts +0 -14
- package/dist/exports/config.context.js +0 -8
- package/dist/exports/expression-result.d.ts +0 -19
- package/dist/exports/expression-result.js +0 -1
- package/dist/exports/interaction.d.ts +0 -46
- package/dist/exports/interaction.interface.d.ts +0 -13
- package/dist/exports/interaction.interface.js +0 -1
- package/dist/exports/interaction.js +0 -12
- package/dist/exports/item.context.d.ts +0 -11
- package/dist/exports/item.context.js +0 -8
- package/dist/exports/qti-assessment-item.context.d.ts +0 -9
- package/dist/exports/qti-assessment-item.context.js +0 -8
- package/dist/exports/qti-condition-expression.d.ts +0 -14
- package/dist/exports/qti-condition-expression.js +0 -11
- package/dist/exports/qti-condition-expression.js.map +0 -1
- package/dist/exports/qti-expression.d.ts +0 -23
- package/dist/exports/qti-expression.js +0 -10
- package/dist/exports/qti-expression.js.map +0 -1
- package/dist/exports/qti-test.d.ts +0 -12
- package/dist/exports/qti-test.js +0 -1
- package/dist/exports/qti-test.js.map +0 -1
- package/dist/exports/qti.context.d.ts +0 -14
- package/dist/exports/qti.context.js +0 -8
- package/dist/exports/qti.context.js.map +0 -1
- package/dist/exports/session.context.d.ts +0 -15
- package/dist/exports/session.context.js +0 -10
- package/dist/exports/session.context.js.map +0 -1
- package/dist/exports/test.context.d.ts +0 -16
- package/dist/exports/test.context.js +0 -10
- package/dist/exports/test.context.js.map +0 -1
- package/dist/exports/variables.d.ts +0 -2
- package/dist/exports/variables.js +0 -1
- package/dist/exports/variables.js.map +0 -1
- package/dist/qti-assessment-item-l-mN3teH.d.ts +0 -105
- package/dist/qti-components/index.d.ts +0 -1524
- package/dist/qti-components/index.js +0 -216
- package/dist/qti-components/index.js.map +0 -1
- package/dist/qti-item/index.d.ts +0 -114
- package/dist/qti-item/index.js +0 -19
- package/dist/qti-item/index.js.map +0 -1
- package/dist/qti-loader/index.d.ts +0 -21
- package/dist/qti-loader/index.js.map +0 -1
- package/dist/qti-modal-feedback-Cp3CHVKw.d.ts +0 -30
- package/dist/qti-test/index.d.ts +0 -480
- package/dist/qti-test/index.js.map +0 -1
- package/dist/qti-test-mmY8zNIj.d.ts +0 -120
- package/dist/qti-transform-test-Bz9A3hmD.d.ts +0 -63
- package/dist/qti-transformers/index.d.ts +0 -18
- package/dist/qti-transformers/index.js.map +0 -1
- package/dist/variables-BCkyLoXK.d.ts +0 -55
- package/readme.md +0 -59
- /package/dist/{chunks/chunk-H2JE6IVU.js.map → base.js.map} +0 -0
- /package/dist/{exports/computed-item.context.js.map → chunk-EUXUH3YW.js.map} +0 -0
- /package/dist/{exports/computed.context.js.map → elements.js.map} +0 -0
- /package/dist/{exports/config.context.js.map → interactions.js.map} +0 -0
- /package/dist/{exports/expression-result.js.map → item.js.map} +0 -0
- /package/dist/{exports/interaction.interface.js.map → loader.js.map} +0 -0
- /package/dist/{exports/interaction.js.map → processing.js.map} +0 -0
- /package/dist/{exports/item.context.js.map → test.js.map} +0 -0
- /package/dist/{exports/qti-assessment-item.context.js.map → transformers.js.map} +0 -0
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
import {
|
|
2
2
|
QtiModalFeedback
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-O4XIWHTF.js";
|
|
4
4
|
import {
|
|
5
|
-
item_default
|
|
6
|
-
|
|
5
|
+
item_default,
|
|
6
|
+
m
|
|
7
|
+
} from "./chunk-W4SQRNWO.js";
|
|
7
8
|
import {
|
|
8
9
|
watch
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2ZEJ3RR5.js";
|
|
10
11
|
import {
|
|
11
12
|
qtiTransformItem,
|
|
12
13
|
qtiTransformTest
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
qtiContext
|
|
16
|
-
} from "./chunk-H6KHXSIO.js";
|
|
14
|
+
} from "./chunk-INKI27D5.js";
|
|
17
15
|
import {
|
|
16
|
+
E,
|
|
18
17
|
INITIAL_SESSION_CONTEXT,
|
|
19
|
-
sessionContext
|
|
20
|
-
} from "./chunk-C5RLRG3L.js";
|
|
21
|
-
import {
|
|
22
18
|
INITIAL_TEST_CONTEXT,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
W,
|
|
20
|
+
c,
|
|
21
|
+
computedContext,
|
|
22
|
+
configContext,
|
|
23
|
+
e,
|
|
24
|
+
i,
|
|
25
|
+
i2,
|
|
26
|
+
n,
|
|
27
|
+
qtiContext,
|
|
28
|
+
r,
|
|
29
|
+
sessionContext,
|
|
30
|
+
t,
|
|
31
|
+
testContext,
|
|
32
|
+
w,
|
|
33
|
+
x
|
|
34
|
+
} from "./chunk-JEUY3MYB.js";
|
|
31
35
|
import {
|
|
32
36
|
__decorateClass
|
|
33
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-EUXUH3YW.js";
|
|
34
38
|
|
|
35
|
-
//
|
|
36
|
-
import { html } from "lit";
|
|
37
|
-
import { customElement } from "lit/decorators.js";
|
|
38
|
-
|
|
39
|
-
// src/lib/qti-test/core/mixins/test-navigation.mixin.ts
|
|
40
|
-
import { property } from "lit/decorators.js";
|
|
39
|
+
// ../qti-test/src/mixins/test-navigation.mixin.ts
|
|
41
40
|
var TestNavigationMixin = (superClass) => {
|
|
42
41
|
class TestNavigationClass extends superClass {
|
|
43
42
|
constructor(...args) {
|
|
@@ -92,15 +91,15 @@ var TestNavigationMixin = (superClass) => {
|
|
|
92
91
|
this.addEventListener("qti-assessment-item-connected", this._handleItemConnected.bind(this));
|
|
93
92
|
this.addEventListener("qti-assessment-stimulus-ref-connected", this._handleStimulusRefConnected.bind(this));
|
|
94
93
|
}
|
|
95
|
-
_handleTestConnected(
|
|
96
|
-
this._testElement =
|
|
94
|
+
_handleTestConnected(e2) {
|
|
95
|
+
this._testElement = e2.detail;
|
|
97
96
|
this._initializeNavigation();
|
|
98
97
|
}
|
|
99
98
|
/**
|
|
100
99
|
* Handle item connection events - track connected items and discover stimulus references
|
|
101
100
|
*/
|
|
102
|
-
_handleItemConnected(
|
|
103
|
-
const itemRef =
|
|
101
|
+
_handleItemConnected(e2) {
|
|
102
|
+
const itemRef = e2.detail;
|
|
104
103
|
this._loadingState.connectedItems++;
|
|
105
104
|
const stimulusRefs = itemRef.querySelectorAll("qti-assessment-stimulus-ref");
|
|
106
105
|
this._loadingState.expectedStimulus += stimulusRefs.length;
|
|
@@ -109,9 +108,9 @@ var TestNavigationMixin = (superClass) => {
|
|
|
109
108
|
/**
|
|
110
109
|
* Handle stimulus reference connection events with duplicate prevention
|
|
111
110
|
*/
|
|
112
|
-
async _handleStimulusRefConnected(
|
|
113
|
-
|
|
114
|
-
const { element, item } =
|
|
111
|
+
async _handleStimulusRefConnected(e2) {
|
|
112
|
+
e2.preventDefault();
|
|
113
|
+
const { element, item } = e2;
|
|
115
114
|
console.info("Stimulus ref connected:", {
|
|
116
115
|
identifier: element.identifier,
|
|
117
116
|
href: element.href,
|
|
@@ -464,39 +463,39 @@ var TestNavigationMixin = (superClass) => {
|
|
|
464
463
|
}
|
|
465
464
|
}
|
|
466
465
|
__decorateClass([
|
|
467
|
-
|
|
466
|
+
n({ type: String })
|
|
468
467
|
], TestNavigationClass.prototype, "navigate", 2);
|
|
469
468
|
__decorateClass([
|
|
470
|
-
|
|
469
|
+
n({ type: Boolean, attribute: "cache-transform" })
|
|
471
470
|
], TestNavigationClass.prototype, "cacheTransform", 2);
|
|
472
471
|
__decorateClass([
|
|
473
|
-
|
|
472
|
+
n({ type: Number })
|
|
474
473
|
], TestNavigationClass.prototype, "requestTimeout", 2);
|
|
475
474
|
__decorateClass([
|
|
476
|
-
|
|
475
|
+
n({ attribute: false })
|
|
477
476
|
], TestNavigationClass.prototype, "postLoadTransformCallback", 2);
|
|
478
477
|
__decorateClass([
|
|
479
|
-
|
|
478
|
+
n({ attribute: false })
|
|
480
479
|
], TestNavigationClass.prototype, "postLoadTestTransformCallback", 2);
|
|
481
480
|
return TestNavigationClass;
|
|
482
481
|
};
|
|
483
482
|
|
|
484
|
-
//
|
|
483
|
+
// ../qti-test/src/mixins/test-view.mixin.ts
|
|
485
484
|
var TestViewMixin = (superClass) => {
|
|
486
485
|
class TestViewClass extends superClass {
|
|
487
486
|
constructor(...args) {
|
|
488
487
|
super(...args);
|
|
489
488
|
this.sessionContext = { ...this.sessionContext, view: "candidate" };
|
|
490
|
-
this.addEventListener("on-test-switch-view", (
|
|
491
|
-
this.sessionContext = { ...this.sessionContext, view:
|
|
489
|
+
this.addEventListener("on-test-switch-view", (e2) => {
|
|
490
|
+
this.sessionContext = { ...this.sessionContext, view: e2.detail };
|
|
492
491
|
this._updateElementView();
|
|
493
492
|
});
|
|
494
493
|
this.addEventListener("qti-assessment-test-connected", () => {
|
|
495
494
|
this._updateElementView();
|
|
496
495
|
});
|
|
497
|
-
this.addEventListener("qti-assessment-item-connected", (
|
|
496
|
+
this.addEventListener("qti-assessment-item-connected", (e2) => {
|
|
498
497
|
this._updateElementView();
|
|
499
|
-
this._setCorrectResponseVisibility(
|
|
498
|
+
this._setCorrectResponseVisibility(e2.detail);
|
|
500
499
|
});
|
|
501
500
|
}
|
|
502
501
|
willUpdate(changedProperties) {
|
|
@@ -529,146 +528,151 @@ var TestViewMixin = (superClass) => {
|
|
|
529
528
|
return TestViewClass;
|
|
530
529
|
};
|
|
531
530
|
|
|
532
|
-
//
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
constructor() {
|
|
538
|
-
super();
|
|
539
|
-
this.testContext = INITIAL_TEST_CONTEXT;
|
|
540
|
-
this.sessionContext = INITIAL_SESSION_CONTEXT;
|
|
541
|
-
/**
|
|
542
|
-
* Updates the variables of an assessment item in the test context.
|
|
543
|
-
* - Matches the assessment item with the corresponding test context item.
|
|
544
|
-
* - If the item is not found, logs a warning.
|
|
545
|
-
* - Updates variables in the test context if exactly one variable exists.
|
|
546
|
-
* - Otherwise, syncs the assessment item's variables with the test context.
|
|
547
|
-
*
|
|
548
|
-
* @param assessmentItem - The assessment item to update.
|
|
549
|
-
*/
|
|
550
|
-
this._updateItemInTestContext = (assessmentItem) => {
|
|
551
|
-
const context = assessmentItem._context;
|
|
552
|
-
const identifier = context.identifier;
|
|
553
|
-
const fullVariables = context.variables;
|
|
554
|
-
const itemContext = this.testContext.items.find((i) => i?.identifier === identifier);
|
|
555
|
-
if (!itemContext) {
|
|
556
|
-
console.warn(`Item IDs between assessment.xml and item.xml should match: ${identifier} is not found!`);
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
if (itemContext.variables?.length === 1) {
|
|
560
|
-
this._updateItemVariablesInTestContext(identifier, fullVariables);
|
|
561
|
-
} else {
|
|
562
|
-
const newVariables = [...assessmentItem.variables];
|
|
563
|
-
for (const variable of itemContext.variables) {
|
|
564
|
-
const currentVariable = newVariables.find((v) => v.identifier === variable.identifier);
|
|
565
|
-
if (currentVariable) {
|
|
566
|
-
currentVariable.value = variable.value;
|
|
567
|
-
} else {
|
|
568
|
-
newVariables.push(variable);
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
assessmentItem.variables = newVariables;
|
|
572
|
-
}
|
|
573
|
-
};
|
|
574
|
-
this.addEventListener("qti-assessment-test-connected", (e) => {
|
|
531
|
+
// ../qti-test/src/mixins/test-base.ts
|
|
532
|
+
var TestBaseMixin = (superClass) => {
|
|
533
|
+
class TestBaseClass extends superClass {
|
|
534
|
+
constructor(...args) {
|
|
535
|
+
super(...args);
|
|
575
536
|
this.testContext = INITIAL_TEST_CONTEXT;
|
|
576
537
|
this.sessionContext = INITIAL_SESSION_CONTEXT;
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
538
|
+
/**
|
|
539
|
+
* Updates the variables of an assessment item in the test context.
|
|
540
|
+
* - Matches the assessment item with the corresponding test context item.
|
|
541
|
+
* - If the item is not found, logs a warning.
|
|
542
|
+
* - Updates variables in the test context if exactly one variable exists.
|
|
543
|
+
* - Otherwise, syncs the assessment item's variables with the test context.
|
|
544
|
+
*
|
|
545
|
+
* @param assessmentItem - The assessment item to update.
|
|
546
|
+
*/
|
|
547
|
+
this._updateItemInTestContext = (assessmentItem) => {
|
|
548
|
+
const context = assessmentItem._context;
|
|
549
|
+
const identifier = context.identifier;
|
|
550
|
+
const fullVariables = context.variables;
|
|
551
|
+
const itemContext = this.testContext.items.find((i4) => i4?.identifier === identifier);
|
|
552
|
+
if (!itemContext) {
|
|
553
|
+
console.warn(`Item IDs between assessment.xml and item.xml should match: ${identifier} is not found!`);
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
if (itemContext.variables?.length === 1) {
|
|
557
|
+
this._updateItemVariablesInTestContext(identifier, fullVariables);
|
|
558
|
+
} else {
|
|
559
|
+
const newVariables = [...assessmentItem.variables];
|
|
560
|
+
for (const variable of itemContext.variables) {
|
|
561
|
+
const currentVariable = newVariables.find((v) => v.identifier === variable.identifier);
|
|
562
|
+
if (currentVariable) {
|
|
563
|
+
currentVariable.value = variable.value;
|
|
564
|
+
} else {
|
|
565
|
+
newVariables.push(variable);
|
|
589
566
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
const
|
|
598
|
-
if (
|
|
599
|
-
|
|
567
|
+
}
|
|
568
|
+
assessmentItem.variables = newVariables;
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
this._initializeEventListeners();
|
|
572
|
+
}
|
|
573
|
+
updateItemVariables(itemRefID, variables) {
|
|
574
|
+
const itemContext = this.testContext.items.find((item) => item.identifier === itemRefID);
|
|
575
|
+
if (itemContext) {
|
|
576
|
+
itemContext.variables = itemContext.variables.map((variable) => {
|
|
577
|
+
const updatedVariable = variables.find((v) => v.identifier === variable.identifier);
|
|
578
|
+
return updatedVariable ? { ...variable, ...updatedVariable } : variable;
|
|
579
|
+
});
|
|
600
580
|
}
|
|
601
|
-
this.
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
581
|
+
const itemRef = this._testElement.querySelector(
|
|
582
|
+
`qti-assessment-item-ref[identifier="${itemRefID}"]`
|
|
583
|
+
);
|
|
584
|
+
if (itemRef && itemRef.assessmentItem) {
|
|
585
|
+
itemRef.assessmentItem.variables = variables;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
_initializeEventListeners() {
|
|
589
|
+
this.addEventListener("qti-assessment-test-connected", (e2) => {
|
|
590
|
+
this.testContext = INITIAL_TEST_CONTEXT;
|
|
591
|
+
this.sessionContext = INITIAL_SESSION_CONTEXT;
|
|
592
|
+
if (this.testContext && this.testContext.items.length > 0) return;
|
|
593
|
+
this._testElement = e2.detail;
|
|
594
|
+
const items = Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map((itemRef) => {
|
|
595
|
+
return {
|
|
596
|
+
href: itemRef.href,
|
|
597
|
+
identifier: itemRef.identifier,
|
|
598
|
+
category: itemRef.category,
|
|
599
|
+
variables: [
|
|
600
|
+
{
|
|
601
|
+
identifier: "completionStatus",
|
|
602
|
+
value: "not_attempted",
|
|
603
|
+
type: "outcome"
|
|
604
|
+
}
|
|
605
|
+
]
|
|
606
|
+
};
|
|
607
|
+
});
|
|
608
|
+
this.testContext = { ...this.testContext, items };
|
|
609
|
+
});
|
|
610
|
+
this.addEventListener("qti-assessment-item-connected", (e2) => {
|
|
611
|
+
const assessmentItem = e2.detail;
|
|
612
|
+
const assessmentRefId = assessmentItem.closest("qti-assessment-item-ref")?.identifier;
|
|
613
|
+
if (assessmentRefId) {
|
|
614
|
+
assessmentItem.assessmentItemRefId = assessmentRefId;
|
|
615
|
+
}
|
|
616
|
+
this._updateItemInTestContext(e2.detail);
|
|
617
|
+
});
|
|
618
|
+
this.addEventListener("qti-item-context-updated", (e2) => {
|
|
619
|
+
this._updateItemVariablesInTestContext(e2.detail.itemContext.identifier, e2.detail.itemContext.variables);
|
|
613
620
|
});
|
|
614
621
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
622
|
+
_updateItemVariablesInTestContext(identifier, variables) {
|
|
623
|
+
this.testContext = {
|
|
624
|
+
...this.testContext,
|
|
625
|
+
// Spread existing test context properties
|
|
626
|
+
items: this.testContext.items.map((itemContext) => {
|
|
627
|
+
if (itemContext.identifier !== identifier) {
|
|
628
|
+
return itemContext;
|
|
629
|
+
}
|
|
630
|
+
return {
|
|
631
|
+
...itemContext,
|
|
632
|
+
// Keep other properties of the item context
|
|
633
|
+
variables: variables.map((variable) => {
|
|
634
|
+
const matchingVariable = itemContext.variables.find((v) => v.identifier === variable.identifier);
|
|
635
|
+
return matchingVariable ? { ...matchingVariable, ...variable } : variable;
|
|
636
|
+
})
|
|
637
|
+
};
|
|
638
|
+
})
|
|
639
|
+
};
|
|
640
|
+
this.dispatchEvent(
|
|
641
|
+
new CustomEvent("qti-test-context-updated", { detail: this.testContext, bubbles: false, composed: false })
|
|
642
|
+
);
|
|
620
643
|
}
|
|
621
644
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
variables: variables.map((variable) => {
|
|
634
|
-
const matchingVariable = itemContext.variables.find((v) => v.identifier === variable.identifier);
|
|
635
|
-
return matchingVariable ? { ...matchingVariable, ...variable } : variable;
|
|
636
|
-
})
|
|
637
|
-
};
|
|
638
|
-
})
|
|
639
|
-
};
|
|
640
|
-
this.dispatchEvent(
|
|
641
|
-
new CustomEvent("qti-test-context-updated", { detail: this.testContext, bubbles: false, composed: false })
|
|
642
|
-
);
|
|
643
|
-
}
|
|
645
|
+
__decorateClass([
|
|
646
|
+
n({ attribute: false, type: Object }),
|
|
647
|
+
e({ context: testContext })
|
|
648
|
+
], TestBaseClass.prototype, "testContext", 2);
|
|
649
|
+
__decorateClass([
|
|
650
|
+
n({ attribute: false, type: Object }),
|
|
651
|
+
e({ context: sessionContext })
|
|
652
|
+
], TestBaseClass.prototype, "sessionContext", 2);
|
|
653
|
+
return TestBaseClass;
|
|
654
|
+
};
|
|
655
|
+
var TestBase = class extends TestBaseMixin(i2) {
|
|
644
656
|
};
|
|
645
|
-
__decorateClass([
|
|
646
|
-
property2({ attribute: false, type: Object }),
|
|
647
|
-
provide({ context: testContext })
|
|
648
|
-
], TestBase.prototype, "testContext", 2);
|
|
649
|
-
__decorateClass([
|
|
650
|
-
property2({ attribute: false, type: Object }),
|
|
651
|
-
provide({ context: sessionContext })
|
|
652
|
-
], TestBase.prototype, "sessionContext", 2);
|
|
653
657
|
|
|
654
|
-
//
|
|
658
|
+
// ../qti-test/src/mixins/test-processing.mixin.ts
|
|
655
659
|
var TestProcessingMixin = (superClass) => {
|
|
656
660
|
class TestProcessingElement extends superClass {
|
|
657
661
|
constructor(...args) {
|
|
658
662
|
super(...args);
|
|
659
|
-
this.addEventListener("qti-register-variable", (
|
|
663
|
+
this.addEventListener("qti-register-variable", (e2) => {
|
|
660
664
|
this.testContext = {
|
|
661
665
|
...this.testContext,
|
|
662
|
-
testOutcomeVariables: [...this.testContext.testOutcomeVariables || [],
|
|
666
|
+
testOutcomeVariables: [...this.testContext.testOutcomeVariables || [], e2.detail.variable]
|
|
663
667
|
};
|
|
664
|
-
|
|
668
|
+
e2.stopPropagation();
|
|
665
669
|
});
|
|
666
670
|
this.addEventListener(
|
|
667
671
|
"qti-set-outcome-value",
|
|
668
|
-
(
|
|
669
|
-
const { outcomeIdentifier, value } =
|
|
672
|
+
(e2) => {
|
|
673
|
+
const { outcomeIdentifier, value } = e2.detail;
|
|
670
674
|
this.updateOutcomeVariable(outcomeIdentifier, value);
|
|
671
|
-
|
|
675
|
+
e2.stopPropagation();
|
|
672
676
|
}
|
|
673
677
|
);
|
|
674
678
|
}
|
|
@@ -709,8 +713,9 @@ var TestProcessingMixin = (superClass) => {
|
|
|
709
713
|
return TestProcessingElement;
|
|
710
714
|
};
|
|
711
715
|
|
|
712
|
-
// src/
|
|
713
|
-
var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixin(
|
|
716
|
+
// ../qti-test/src/components/qti-test/qti-test.ts
|
|
717
|
+
var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixin(TestBaseMixin(i2)))) {
|
|
718
|
+
// TODO: Properly implement IQtiTest interface
|
|
714
719
|
// export class QtiTest extends TestLoaderMixin(TestNavigationMixin(TestViewMixin(TestBase))) {
|
|
715
720
|
/**
|
|
716
721
|
* Renders the component's template.
|
|
@@ -722,16 +727,14 @@ var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixi
|
|
|
722
727
|
this.dispatchEvent(new CustomEvent("qti-test-connected", { detail: this }));
|
|
723
728
|
}
|
|
724
729
|
render() {
|
|
725
|
-
return
|
|
730
|
+
return x`<slot></slot>`;
|
|
726
731
|
}
|
|
727
732
|
};
|
|
728
733
|
QtiTest = __decorateClass([
|
|
729
|
-
|
|
734
|
+
t("qti-test")
|
|
730
735
|
], QtiTest);
|
|
731
736
|
|
|
732
|
-
//
|
|
733
|
-
import { LitElement as LitElement2 } from "lit";
|
|
734
|
-
import { property as property3 } from "lit/decorators.js";
|
|
737
|
+
// ../qti-test/src/components/qti-assessment-item-ref/qti-assessment-item-ref.ts
|
|
735
738
|
var stringToBooleanConverter = {
|
|
736
739
|
fromAttribute(value) {
|
|
737
740
|
return value === "true";
|
|
@@ -740,7 +743,7 @@ var stringToBooleanConverter = {
|
|
|
740
743
|
return value ? "true" : "false";
|
|
741
744
|
}
|
|
742
745
|
};
|
|
743
|
-
var QtiAssessmentItemRef = class extends
|
|
746
|
+
var QtiAssessmentItemRef = class extends i2 {
|
|
744
747
|
constructor() {
|
|
745
748
|
super(...arguments);
|
|
746
749
|
// @consume({ context: computedContext, subscribe: true })
|
|
@@ -770,31 +773,28 @@ var QtiAssessmentItemRef = class extends LitElement2 {
|
|
|
770
773
|
}
|
|
771
774
|
};
|
|
772
775
|
__decorateClass([
|
|
773
|
-
|
|
776
|
+
n({ type: String })
|
|
774
777
|
], QtiAssessmentItemRef.prototype, "category", 2);
|
|
775
778
|
__decorateClass([
|
|
776
|
-
|
|
779
|
+
n({ type: String })
|
|
777
780
|
], QtiAssessmentItemRef.prototype, "identifier", 2);
|
|
778
781
|
__decorateClass([
|
|
779
|
-
|
|
782
|
+
n({ type: Boolean, converter: stringToBooleanConverter })
|
|
780
783
|
], QtiAssessmentItemRef.prototype, "required", 2);
|
|
781
784
|
__decorateClass([
|
|
782
|
-
|
|
785
|
+
n({ type: Boolean, converter: stringToBooleanConverter })
|
|
783
786
|
], QtiAssessmentItemRef.prototype, "fixed", 2);
|
|
784
787
|
__decorateClass([
|
|
785
|
-
|
|
788
|
+
n({ type: String })
|
|
786
789
|
], QtiAssessmentItemRef.prototype, "href", 2);
|
|
787
790
|
__decorateClass([
|
|
788
|
-
|
|
791
|
+
n({ type: Object, attribute: false })
|
|
789
792
|
], QtiAssessmentItemRef.prototype, "xmlDoc", 2);
|
|
790
793
|
if (!customElements.get("qti-assessment-item-ref")) {
|
|
791
794
|
customElements.define("qti-assessment-item-ref", QtiAssessmentItemRef);
|
|
792
795
|
}
|
|
793
796
|
|
|
794
|
-
//
|
|
795
|
-
import { consume } from "@lit/context";
|
|
796
|
-
import { html as html2, LitElement as LitElement3 } from "lit";
|
|
797
|
-
import { property as property4 } from "lit/decorators.js";
|
|
797
|
+
// ../qti-test/src/components/qti-assessment-section/qti-assessment-section.ts
|
|
798
798
|
var stringToBooleanConverter2 = {
|
|
799
799
|
fromAttribute(value) {
|
|
800
800
|
return value === "true";
|
|
@@ -803,7 +803,7 @@ var stringToBooleanConverter2 = {
|
|
|
803
803
|
return value ? "true" : "false";
|
|
804
804
|
}
|
|
805
805
|
};
|
|
806
|
-
var QtiAssessmentSection = class extends
|
|
806
|
+
var QtiAssessmentSection = class extends i2 {
|
|
807
807
|
constructor() {
|
|
808
808
|
super(...arguments);
|
|
809
809
|
this._title = "";
|
|
@@ -828,36 +828,33 @@ var QtiAssessmentSection = class extends LitElement3 {
|
|
|
828
828
|
);
|
|
829
829
|
}
|
|
830
830
|
render() {
|
|
831
|
-
return
|
|
831
|
+
return x`<slot name="qti-rubric-block"></slot><slot></slot>`;
|
|
832
832
|
}
|
|
833
833
|
};
|
|
834
834
|
__decorateClass([
|
|
835
|
-
|
|
835
|
+
n({ type: String })
|
|
836
836
|
], QtiAssessmentSection.prototype, "identifier", 2);
|
|
837
837
|
__decorateClass([
|
|
838
|
-
|
|
838
|
+
n({ type: String })
|
|
839
839
|
], QtiAssessmentSection.prototype, "required", 2);
|
|
840
840
|
__decorateClass([
|
|
841
|
-
|
|
841
|
+
n({ type: Boolean, converter: stringToBooleanConverter2 })
|
|
842
842
|
], QtiAssessmentSection.prototype, "fixed", 2);
|
|
843
843
|
__decorateClass([
|
|
844
|
-
|
|
844
|
+
n({ type: Boolean, converter: stringToBooleanConverter2 })
|
|
845
845
|
], QtiAssessmentSection.prototype, "visible", 2);
|
|
846
846
|
__decorateClass([
|
|
847
|
-
|
|
847
|
+
n({ type: Boolean, converter: stringToBooleanConverter2, attribute: "keep-together" })
|
|
848
848
|
], QtiAssessmentSection.prototype, "keepTogether", 2);
|
|
849
849
|
__decorateClass([
|
|
850
|
-
|
|
850
|
+
c({ context: testContext, subscribe: true })
|
|
851
851
|
], QtiAssessmentSection.prototype, "_testContext", 2);
|
|
852
852
|
if (!customElements.get("qti-assessment-section")) {
|
|
853
853
|
customElements.define("qti-assessment-section", QtiAssessmentSection);
|
|
854
854
|
}
|
|
855
855
|
|
|
856
|
-
//
|
|
857
|
-
|
|
858
|
-
import { html as html3, LitElement as LitElement4 } from "lit";
|
|
859
|
-
import { customElement as customElement2, property as property5 } from "lit/decorators.js";
|
|
860
|
-
var QtiAssessmentTest = class extends LitElement4 {
|
|
856
|
+
// ../qti-test/src/components/qti-assessment-test/qti-assessment-test.ts
|
|
857
|
+
var QtiAssessmentTest = class extends i2 {
|
|
861
858
|
constructor() {
|
|
862
859
|
super(...arguments);
|
|
863
860
|
this._title = "";
|
|
@@ -882,26 +879,24 @@ var QtiAssessmentTest = class extends LitElement4 {
|
|
|
882
879
|
);
|
|
883
880
|
}
|
|
884
881
|
render() {
|
|
885
|
-
return
|
|
882
|
+
return x` <slot></slot>`;
|
|
886
883
|
}
|
|
887
884
|
};
|
|
888
885
|
__decorateClass([
|
|
889
|
-
|
|
886
|
+
n({ type: String })
|
|
890
887
|
], QtiAssessmentTest.prototype, "identifier", 2);
|
|
891
888
|
__decorateClass([
|
|
892
|
-
|
|
889
|
+
n({ type: String })
|
|
893
890
|
], QtiAssessmentTest.prototype, "title", 1);
|
|
894
891
|
__decorateClass([
|
|
895
|
-
|
|
892
|
+
c({ context: testContext, subscribe: true })
|
|
896
893
|
], QtiAssessmentTest.prototype, "_testContext", 2);
|
|
897
894
|
QtiAssessmentTest = __decorateClass([
|
|
898
|
-
|
|
895
|
+
t("qti-assessment-test")
|
|
899
896
|
], QtiAssessmentTest);
|
|
900
897
|
|
|
901
|
-
//
|
|
902
|
-
|
|
903
|
-
import { customElement as customElement3, property as property6 } from "lit/decorators.js";
|
|
904
|
-
var QtiTestPart = class extends LitElement5 {
|
|
898
|
+
// ../qti-test/src/components/qti-test-part/qti-test-part.ts
|
|
899
|
+
var QtiTestPart = class extends i2 {
|
|
905
900
|
constructor() {
|
|
906
901
|
super(...arguments);
|
|
907
902
|
this.identifier = "";
|
|
@@ -929,50 +924,45 @@ var QtiTestPart = class extends LitElement5 {
|
|
|
929
924
|
);
|
|
930
925
|
}
|
|
931
926
|
render() {
|
|
932
|
-
return
|
|
927
|
+
return x` <slot></slot>`;
|
|
933
928
|
}
|
|
934
929
|
};
|
|
935
930
|
__decorateClass([
|
|
936
|
-
|
|
931
|
+
n({ type: String })
|
|
937
932
|
], QtiTestPart.prototype, "identifier", 2);
|
|
938
933
|
__decorateClass([
|
|
939
|
-
|
|
934
|
+
n({ type: String })
|
|
940
935
|
], QtiTestPart.prototype, "class", 2);
|
|
941
936
|
__decorateClass([
|
|
942
|
-
|
|
937
|
+
n({ type: String, attribute: "navigation-mode" })
|
|
943
938
|
], QtiTestPart.prototype, "navigationMode", 2);
|
|
944
939
|
__decorateClass([
|
|
945
|
-
|
|
940
|
+
n({ type: String, attribute: "submission-mode" })
|
|
946
941
|
], QtiTestPart.prototype, "submissionMode", 2);
|
|
947
942
|
QtiTestPart = __decorateClass([
|
|
948
|
-
|
|
943
|
+
t("qti-test-part")
|
|
949
944
|
], QtiTestPart);
|
|
950
945
|
if (!customElements.get("qti-test-part")) {
|
|
951
946
|
customElements.define("qti-test-part", QtiTestPart);
|
|
952
947
|
}
|
|
953
948
|
|
|
954
|
-
//
|
|
955
|
-
import { customElement as customElement4 } from "lit/decorators.js";
|
|
956
|
-
import { css, html as html5 } from "lit";
|
|
949
|
+
// ../qti-test/src/components/qti-test-feedback/qti-test-feedback.ts
|
|
957
950
|
var QtiTestFeedback = class extends QtiModalFeedback {
|
|
958
951
|
render() {
|
|
959
|
-
return
|
|
952
|
+
return x``;
|
|
960
953
|
}
|
|
961
954
|
};
|
|
962
|
-
QtiTestFeedback.styles =
|
|
955
|
+
QtiTestFeedback.styles = i`
|
|
963
956
|
:host {
|
|
964
957
|
color: gray;
|
|
965
958
|
}
|
|
966
959
|
`;
|
|
967
960
|
QtiTestFeedback = __decorateClass([
|
|
968
|
-
|
|
961
|
+
t("qti-test-feedback")
|
|
969
962
|
], QtiTestFeedback);
|
|
970
963
|
|
|
971
|
-
//
|
|
972
|
-
|
|
973
|
-
import { html as html6, LitElement as LitElement6 } from "lit";
|
|
974
|
-
import { customElement as customElement5, property as property7, state } from "lit/decorators.js";
|
|
975
|
-
var TestNavigation = class extends LitElement6 {
|
|
964
|
+
// ../qti-test/src/components/test-navigation/test-navigation.ts
|
|
965
|
+
var TestNavigation = class extends i2 {
|
|
976
966
|
constructor() {
|
|
977
967
|
super();
|
|
978
968
|
this.identifier = void 0;
|
|
@@ -1057,7 +1047,9 @@ var TestNavigation = class extends LitElement6 {
|
|
|
1057
1047
|
}
|
|
1058
1048
|
_handleInteractionChanged(_event) {
|
|
1059
1049
|
if (this.autoScoreItems) {
|
|
1060
|
-
const assessmentItem = _event.composedPath()[0].closest(
|
|
1050
|
+
const assessmentItem = _event.composedPath()[0].closest(
|
|
1051
|
+
"qti-assessment-item"
|
|
1052
|
+
);
|
|
1061
1053
|
const scoreOutcomeIdentifier = assessmentItem.variables.find((v) => v.identifier === "SCORE");
|
|
1062
1054
|
if (scoreOutcomeIdentifier && scoreOutcomeIdentifier.externalScored === null && assessmentItem.adaptive === "false") {
|
|
1063
1055
|
const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
|
|
@@ -1066,7 +1058,7 @@ var TestNavigation = class extends LitElement6 {
|
|
|
1066
1058
|
}
|
|
1067
1059
|
}
|
|
1068
1060
|
render() {
|
|
1069
|
-
return
|
|
1061
|
+
return x`<slot></slot>`;
|
|
1070
1062
|
}
|
|
1071
1063
|
/* PK: on test connected we can build the computed context */
|
|
1072
1064
|
_handleTestConnected(event) {
|
|
@@ -1118,7 +1110,7 @@ var TestNavigation = class extends LitElement6 {
|
|
|
1118
1110
|
identifier: section.identifier,
|
|
1119
1111
|
title: section.title,
|
|
1120
1112
|
items: itemElements.map((item) => ({
|
|
1121
|
-
...this.initContext?.find((
|
|
1113
|
+
...this.initContext?.find((i4) => i4.identifier === item.identifier),
|
|
1122
1114
|
active: false,
|
|
1123
1115
|
identifier: item.identifier,
|
|
1124
1116
|
categories: item.category ? item.category?.split(" ") : [],
|
|
@@ -1189,11 +1181,11 @@ var TestNavigation = class extends LitElement6 {
|
|
|
1189
1181
|
const externalScored = scoreOutcome?.getAttribute("externalScored");
|
|
1190
1182
|
const responseDeclarations = itemElement.querySelectorAll("qti-response-declaration");
|
|
1191
1183
|
const containsCorrectResponse = Array.from(responseDeclarations).some(
|
|
1192
|
-
(
|
|
1184
|
+
(r3) => r3.querySelector("qti-correct-response")
|
|
1193
1185
|
);
|
|
1194
|
-
const containsMapping = Array.from(responseDeclarations).some((
|
|
1195
|
-
const mapping =
|
|
1196
|
-
const areaMapping =
|
|
1186
|
+
const containsMapping = Array.from(responseDeclarations).some((r3) => {
|
|
1187
|
+
const mapping = r3.querySelector("qti-mapping");
|
|
1188
|
+
const areaMapping = r3.querySelector("qti-area-mapping");
|
|
1197
1189
|
return mapping?.querySelector("qti-map-entry") || areaMapping?.querySelector("qti-area-map-entry");
|
|
1198
1190
|
});
|
|
1199
1191
|
const hasCorrectResponse = containsCorrectResponse || containsMapping;
|
|
@@ -1233,14 +1225,14 @@ var TestNavigation = class extends LitElement6 {
|
|
|
1233
1225
|
...section,
|
|
1234
1226
|
active: this._sessionContext?.navSectionId === section.identifier || false,
|
|
1235
1227
|
completed: section.items.every(
|
|
1236
|
-
(item) => this._testContext.items.find((
|
|
1228
|
+
(item) => this._testContext.items.find((i4) => i4.identifier === item.identifier)?.variables.find((v) => v.identifier === "completionStatus").value === "completed"
|
|
1237
1229
|
),
|
|
1238
1230
|
items: section.items.map((item) => {
|
|
1239
|
-
const itemContext = this._testContext?.items.find((
|
|
1231
|
+
const itemContext = this._testContext?.items.find((i4) => i4.identifier === item.identifier);
|
|
1240
1232
|
const computedItem = {
|
|
1241
1233
|
...item,
|
|
1242
1234
|
...itemContext,
|
|
1243
|
-
...this.initContext?.find((
|
|
1235
|
+
...this.initContext?.find((i4) => i4.identifier === item.identifier)
|
|
1244
1236
|
};
|
|
1245
1237
|
const rawscore = computedItem.variables?.find((vr) => vr.identifier == "SCORE")?.value;
|
|
1246
1238
|
const score = rawscore === void 0 || rawscore === null ? null : parseFloat(rawscore?.toString());
|
|
@@ -1280,46 +1272,40 @@ var TestNavigation = class extends LitElement6 {
|
|
|
1280
1272
|
}
|
|
1281
1273
|
};
|
|
1282
1274
|
__decorateClass([
|
|
1283
|
-
|
|
1275
|
+
n({ type: String })
|
|
1284
1276
|
], TestNavigation.prototype, "identifier", 2);
|
|
1285
1277
|
__decorateClass([
|
|
1286
|
-
|
|
1278
|
+
r()
|
|
1287
1279
|
], TestNavigation.prototype, "initContext", 2);
|
|
1288
1280
|
__decorateClass([
|
|
1289
|
-
|
|
1290
|
-
|
|
1281
|
+
r(),
|
|
1282
|
+
e({ context: qtiContext })
|
|
1291
1283
|
], TestNavigation.prototype, "qtiContext", 2);
|
|
1292
1284
|
__decorateClass([
|
|
1293
|
-
|
|
1294
|
-
|
|
1285
|
+
r(),
|
|
1286
|
+
e({ context: configContext })
|
|
1295
1287
|
], TestNavigation.prototype, "configContext", 2);
|
|
1296
1288
|
__decorateClass([
|
|
1297
|
-
|
|
1298
|
-
|
|
1289
|
+
r(),
|
|
1290
|
+
c({ context: testContext, subscribe: true })
|
|
1299
1291
|
], TestNavigation.prototype, "_testContext", 2);
|
|
1300
1292
|
__decorateClass([
|
|
1301
|
-
|
|
1302
|
-
|
|
1293
|
+
r(),
|
|
1294
|
+
c({ context: sessionContext, subscribe: true })
|
|
1303
1295
|
], TestNavigation.prototype, "_sessionContext", 2);
|
|
1304
1296
|
__decorateClass([
|
|
1305
|
-
|
|
1306
|
-
|
|
1297
|
+
r(),
|
|
1298
|
+
e({ context: computedContext })
|
|
1307
1299
|
], TestNavigation.prototype, "computedContext", 2);
|
|
1308
1300
|
__decorateClass([
|
|
1309
|
-
|
|
1301
|
+
n({ type: Boolean, attribute: "auto-score-items" })
|
|
1310
1302
|
], TestNavigation.prototype, "autoScoreItems", 2);
|
|
1311
1303
|
TestNavigation = __decorateClass([
|
|
1312
|
-
|
|
1304
|
+
t("test-navigation")
|
|
1313
1305
|
], TestNavigation);
|
|
1314
1306
|
|
|
1315
|
-
//
|
|
1316
|
-
|
|
1317
|
-
import { customElement as customElement6, property as property8 } from "lit/decorators.js";
|
|
1318
|
-
import { consume as consume4 } from "@lit/context";
|
|
1319
|
-
|
|
1320
|
-
// src/lib/qti-test/components/styles.ts
|
|
1321
|
-
import { css as css2 } from "lit";
|
|
1322
|
-
var form = css2`
|
|
1307
|
+
// ../qti-test/src/components/styles.ts
|
|
1308
|
+
var form = i`
|
|
1323
1309
|
display: inline-flex;
|
|
1324
1310
|
align-items: center;
|
|
1325
1311
|
cursor: pointer;
|
|
@@ -1327,29 +1313,29 @@ var form = css2`
|
|
|
1327
1313
|
border-radius: 0.25rem;
|
|
1328
1314
|
user-select: none;
|
|
1329
1315
|
`;
|
|
1330
|
-
var btn =
|
|
1316
|
+
var btn = i`
|
|
1331
1317
|
background-color: lightgray;
|
|
1332
1318
|
${form};
|
|
1333
1319
|
`;
|
|
1334
|
-
var dis =
|
|
1320
|
+
var dis = i`
|
|
1335
1321
|
cursor: not-allowed;
|
|
1336
1322
|
opacity: 0.8;
|
|
1337
1323
|
`;
|
|
1338
|
-
var ind =
|
|
1324
|
+
var ind = i`
|
|
1339
1325
|
${form};
|
|
1340
1326
|
border: 1px solid gray;
|
|
1341
1327
|
`;
|
|
1342
1328
|
|
|
1343
|
-
//
|
|
1344
|
-
var TestNext = class extends
|
|
1329
|
+
// ../qti-test/src/components/test-next/test-next.ts
|
|
1330
|
+
var TestNext = class extends i2 {
|
|
1345
1331
|
constructor() {
|
|
1346
1332
|
super();
|
|
1347
1333
|
this._internalDisabled = true;
|
|
1348
1334
|
this._internals = this.attachInternals();
|
|
1349
1335
|
this._internals.role = "button";
|
|
1350
1336
|
this._internals.ariaLabel = "Next item";
|
|
1351
|
-
this.addEventListener("click", (
|
|
1352
|
-
|
|
1337
|
+
this.addEventListener("click", (e2) => {
|
|
1338
|
+
e2.preventDefault();
|
|
1353
1339
|
if (!this._internalDisabled) this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);
|
|
1354
1340
|
});
|
|
1355
1341
|
}
|
|
@@ -1386,10 +1372,10 @@ var TestNext = class extends LitElement7 {
|
|
|
1386
1372
|
);
|
|
1387
1373
|
}
|
|
1388
1374
|
render() {
|
|
1389
|
-
return
|
|
1375
|
+
return x`<slot></slot>`;
|
|
1390
1376
|
}
|
|
1391
1377
|
};
|
|
1392
|
-
TestNext.styles =
|
|
1378
|
+
TestNext.styles = i`
|
|
1393
1379
|
:host {
|
|
1394
1380
|
${btn};
|
|
1395
1381
|
}
|
|
@@ -1398,28 +1384,25 @@ TestNext.styles = css3`
|
|
|
1398
1384
|
}
|
|
1399
1385
|
`;
|
|
1400
1386
|
__decorateClass([
|
|
1401
|
-
|
|
1387
|
+
n({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
1402
1388
|
], TestNext.prototype, "_internalDisabled", 2);
|
|
1403
1389
|
__decorateClass([
|
|
1404
|
-
|
|
1390
|
+
c({ context: computedContext, subscribe: true })
|
|
1405
1391
|
], TestNext.prototype, "computedContext", 2);
|
|
1406
1392
|
__decorateClass([
|
|
1407
1393
|
watch("computedContext")
|
|
1408
1394
|
], TestNext.prototype, "_handleTestElementChange", 1);
|
|
1409
1395
|
TestNext = __decorateClass([
|
|
1410
|
-
|
|
1396
|
+
t("test-next")
|
|
1411
1397
|
], TestNext);
|
|
1412
1398
|
|
|
1413
|
-
//
|
|
1414
|
-
|
|
1415
|
-
import { customElement as customElement7, property as property9 } from "lit/decorators.js";
|
|
1416
|
-
import { consume as consume5 } from "@lit/context";
|
|
1417
|
-
var TestPrev = class extends LitElement8 {
|
|
1399
|
+
// ../qti-test/src/components/test-prev/test-prev.ts
|
|
1400
|
+
var TestPrev = class extends i2 {
|
|
1418
1401
|
constructor() {
|
|
1419
1402
|
super();
|
|
1420
1403
|
this._internalDisabled = true;
|
|
1421
|
-
this.addEventListener("click", (
|
|
1422
|
-
|
|
1404
|
+
this.addEventListener("click", (e2) => {
|
|
1405
|
+
e2.preventDefault();
|
|
1423
1406
|
if (!this._internalDisabled) this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);
|
|
1424
1407
|
});
|
|
1425
1408
|
}
|
|
@@ -1452,10 +1435,10 @@ var TestPrev = class extends LitElement8 {
|
|
|
1452
1435
|
);
|
|
1453
1436
|
}
|
|
1454
1437
|
render() {
|
|
1455
|
-
return
|
|
1438
|
+
return x`<slot></slot>`;
|
|
1456
1439
|
}
|
|
1457
1440
|
};
|
|
1458
|
-
TestPrev.styles =
|
|
1441
|
+
TestPrev.styles = i`
|
|
1459
1442
|
:host {
|
|
1460
1443
|
${btn};
|
|
1461
1444
|
}
|
|
@@ -1464,23 +1447,20 @@ TestPrev.styles = css4`
|
|
|
1464
1447
|
}
|
|
1465
1448
|
`;
|
|
1466
1449
|
__decorateClass([
|
|
1467
|
-
|
|
1450
|
+
n({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
1468
1451
|
], TestPrev.prototype, "_internalDisabled", 2);
|
|
1469
1452
|
__decorateClass([
|
|
1470
|
-
|
|
1453
|
+
c({ context: computedContext, subscribe: true })
|
|
1471
1454
|
], TestPrev.prototype, "computedContext", 2);
|
|
1472
1455
|
__decorateClass([
|
|
1473
1456
|
watch("computedContext")
|
|
1474
1457
|
], TestPrev.prototype, "_handleTestElementChange", 1);
|
|
1475
1458
|
TestPrev = __decorateClass([
|
|
1476
|
-
|
|
1459
|
+
t("test-prev")
|
|
1477
1460
|
], TestPrev);
|
|
1478
1461
|
|
|
1479
|
-
//
|
|
1480
|
-
|
|
1481
|
-
import { customElement as customElement8, property as property10, state as state2 } from "lit/decorators.js";
|
|
1482
|
-
import { consume as consume6 } from "@lit/context";
|
|
1483
|
-
var TestView = class extends LitElement9 {
|
|
1462
|
+
// ../qti-test/src/components/test-view-toggle/test-view.ts
|
|
1463
|
+
var TestView = class extends i2 {
|
|
1484
1464
|
constructor() {
|
|
1485
1465
|
super(...arguments);
|
|
1486
1466
|
this.label = "view";
|
|
@@ -1511,18 +1491,18 @@ var TestView = class extends LitElement9 {
|
|
|
1511
1491
|
);
|
|
1512
1492
|
}
|
|
1513
1493
|
render() {
|
|
1514
|
-
return
|
|
1494
|
+
return x`
|
|
1515
1495
|
<label part="label" for="viewSelect">${this.label}</label>
|
|
1516
1496
|
<select
|
|
1517
1497
|
part="select"
|
|
1518
1498
|
id="viewSelect"
|
|
1519
|
-
@change=${(
|
|
1520
|
-
const el =
|
|
1499
|
+
@change=${(e2) => {
|
|
1500
|
+
const el = e2.target;
|
|
1521
1501
|
this._switchView(el.value);
|
|
1522
1502
|
}}
|
|
1523
1503
|
>
|
|
1524
1504
|
${this._viewOptions.map(
|
|
1525
|
-
(v) =>
|
|
1505
|
+
(v) => x`<option value="${v}" ?selected=${v === this.sessionContext.view}>${v}</option>`
|
|
1526
1506
|
)}
|
|
1527
1507
|
</select>
|
|
1528
1508
|
`;
|
|
@@ -1530,28 +1510,26 @@ var TestView = class extends LitElement9 {
|
|
|
1530
1510
|
};
|
|
1531
1511
|
TestView.DEFAULT_VIEW_OPTIONS = ["author", "candidate", "proctor", "scorer", "testConstructor", "tutor"];
|
|
1532
1512
|
__decorateClass([
|
|
1533
|
-
|
|
1513
|
+
c({ context: sessionContext, subscribe: true })
|
|
1534
1514
|
], TestView.prototype, "sessionContext", 2);
|
|
1535
1515
|
__decorateClass([
|
|
1536
|
-
|
|
1516
|
+
n({ type: String })
|
|
1537
1517
|
], TestView.prototype, "label", 2);
|
|
1538
1518
|
__decorateClass([
|
|
1539
|
-
|
|
1519
|
+
n({ type: String, attribute: "view-options" })
|
|
1540
1520
|
], TestView.prototype, "viewOptions", 2);
|
|
1541
1521
|
__decorateClass([
|
|
1542
1522
|
watch("viewOptions", { waitUntilFirstUpdate: true })
|
|
1543
1523
|
], TestView.prototype, "_handleViewOptionsChange", 2);
|
|
1544
1524
|
__decorateClass([
|
|
1545
|
-
|
|
1525
|
+
r()
|
|
1546
1526
|
], TestView.prototype, "_viewOptions", 2);
|
|
1547
1527
|
TestView = __decorateClass([
|
|
1548
|
-
|
|
1528
|
+
t("test-view")
|
|
1549
1529
|
], TestView);
|
|
1550
1530
|
|
|
1551
|
-
//
|
|
1552
|
-
|
|
1553
|
-
import { customElement as customElement9, property as property11 } from "lit/decorators.js";
|
|
1554
|
-
var TestItemLink = class extends LitElement10 {
|
|
1531
|
+
// ../qti-test/src/components/test-item-link/test-item-link.ts
|
|
1532
|
+
var TestItemLink = class extends i2 {
|
|
1555
1533
|
constructor() {
|
|
1556
1534
|
super();
|
|
1557
1535
|
this.itemId = null;
|
|
@@ -1570,10 +1548,10 @@ var TestItemLink = class extends LitElement10 {
|
|
|
1570
1548
|
);
|
|
1571
1549
|
}
|
|
1572
1550
|
render() {
|
|
1573
|
-
return
|
|
1551
|
+
return x` <slot></slot> `;
|
|
1574
1552
|
}
|
|
1575
1553
|
};
|
|
1576
|
-
TestItemLink.styles =
|
|
1554
|
+
TestItemLink.styles = i`
|
|
1577
1555
|
:host {
|
|
1578
1556
|
${btn};
|
|
1579
1557
|
}
|
|
@@ -1582,25 +1560,23 @@ TestItemLink.styles = css5`
|
|
|
1582
1560
|
}
|
|
1583
1561
|
`;
|
|
1584
1562
|
__decorateClass([
|
|
1585
|
-
|
|
1563
|
+
n({ type: String, attribute: "item-id" })
|
|
1586
1564
|
], TestItemLink.prototype, "itemId", 2);
|
|
1587
1565
|
TestItemLink = __decorateClass([
|
|
1588
|
-
|
|
1566
|
+
t("test-item-link")
|
|
1589
1567
|
], TestItemLink);
|
|
1590
1568
|
|
|
1591
|
-
//
|
|
1592
|
-
|
|
1593
|
-
import { customElement as customElement10 } from "lit/decorators.js";
|
|
1594
|
-
var TestEndAttempt = class extends LitElement11 {
|
|
1569
|
+
// ../qti-test/src/components/test-end-attempt/test-end-attempt.ts
|
|
1570
|
+
var TestEndAttempt = class extends i2 {
|
|
1595
1571
|
constructor() {
|
|
1596
1572
|
super();
|
|
1597
1573
|
this.addEventListener("click", () => this.dispatchEvent(new CustomEvent("test-end-attempt", { bubbles: true })));
|
|
1598
1574
|
}
|
|
1599
1575
|
render() {
|
|
1600
|
-
return
|
|
1576
|
+
return x` <slot></slot> `;
|
|
1601
1577
|
}
|
|
1602
1578
|
};
|
|
1603
|
-
TestEndAttempt.styles =
|
|
1579
|
+
TestEndAttempt.styles = i`
|
|
1604
1580
|
:host {
|
|
1605
1581
|
${btn};
|
|
1606
1582
|
}
|
|
@@ -1609,14 +1585,11 @@ TestEndAttempt.styles = css6`
|
|
|
1609
1585
|
}
|
|
1610
1586
|
`;
|
|
1611
1587
|
TestEndAttempt = __decorateClass([
|
|
1612
|
-
|
|
1588
|
+
t("test-end-attempt")
|
|
1613
1589
|
], TestEndAttempt);
|
|
1614
1590
|
|
|
1615
|
-
//
|
|
1616
|
-
|
|
1617
|
-
import { customElement as customElement11, property as property12 } from "lit/decorators.js";
|
|
1618
|
-
import { consume as consume7 } from "@lit/context";
|
|
1619
|
-
var TestShowCorrectResponse = class extends LitElement12 {
|
|
1591
|
+
// ../qti-test/src/components/test-show-correct-response/test-show-correct-response.ts
|
|
1592
|
+
var TestShowCorrectResponse = class extends i2 {
|
|
1620
1593
|
constructor() {
|
|
1621
1594
|
super(...arguments);
|
|
1622
1595
|
this.shown = false;
|
|
@@ -1656,10 +1629,10 @@ var TestShowCorrectResponse = class extends LitElement12 {
|
|
|
1656
1629
|
return this.disabled ? this.noCorrectResponseText : this.shown ? this.hideCorrectText : this.showCorrectText;
|
|
1657
1630
|
}
|
|
1658
1631
|
render() {
|
|
1659
|
-
return
|
|
1632
|
+
return x` <div @click="${this._toggleState}">${this._getDisplayedText()}</div> `;
|
|
1660
1633
|
}
|
|
1661
1634
|
};
|
|
1662
|
-
TestShowCorrectResponse.styles =
|
|
1635
|
+
TestShowCorrectResponse.styles = i`
|
|
1663
1636
|
:host {
|
|
1664
1637
|
${btn};
|
|
1665
1638
|
}
|
|
@@ -1668,33 +1641,1112 @@ TestShowCorrectResponse.styles = css7`
|
|
|
1668
1641
|
}
|
|
1669
1642
|
`;
|
|
1670
1643
|
__decorateClass([
|
|
1671
|
-
|
|
1644
|
+
c({ context: computedContext, subscribe: true })
|
|
1672
1645
|
], TestShowCorrectResponse.prototype, "computedContext", 2);
|
|
1673
1646
|
__decorateClass([
|
|
1674
|
-
|
|
1647
|
+
n({ type: Boolean, reflect: true })
|
|
1675
1648
|
], TestShowCorrectResponse.prototype, "shown", 2);
|
|
1676
1649
|
__decorateClass([
|
|
1677
|
-
|
|
1650
|
+
n({ type: Boolean, reflect: true })
|
|
1678
1651
|
], TestShowCorrectResponse.prototype, "disabled", 2);
|
|
1679
1652
|
__decorateClass([
|
|
1680
|
-
|
|
1653
|
+
n({ type: String })
|
|
1681
1654
|
], TestShowCorrectResponse.prototype, "showCorrectText", 2);
|
|
1682
1655
|
__decorateClass([
|
|
1683
|
-
|
|
1656
|
+
n({ type: String })
|
|
1684
1657
|
], TestShowCorrectResponse.prototype, "hideCorrectText", 2);
|
|
1685
1658
|
__decorateClass([
|
|
1686
|
-
|
|
1659
|
+
n({ type: String })
|
|
1687
1660
|
], TestShowCorrectResponse.prototype, "noCorrectResponseText", 2);
|
|
1688
1661
|
TestShowCorrectResponse = __decorateClass([
|
|
1689
|
-
|
|
1662
|
+
t("test-show-correct-response")
|
|
1690
1663
|
], TestShowCorrectResponse);
|
|
1691
1664
|
|
|
1692
|
-
//
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1665
|
+
// ../../node_modules/.pnpm/@heximal+expressions@0.1.5/node_modules/@heximal/expressions/lib/constants.js
|
|
1666
|
+
var KEYWORDS = ["this"];
|
|
1667
|
+
var UNARY_OPERATORS = ["+", "-", "!"];
|
|
1668
|
+
var BINARY_OPERATORS = [
|
|
1669
|
+
"=",
|
|
1670
|
+
"+",
|
|
1671
|
+
"-",
|
|
1672
|
+
"*",
|
|
1673
|
+
"/",
|
|
1674
|
+
"%",
|
|
1675
|
+
"^",
|
|
1676
|
+
"==",
|
|
1677
|
+
"!=",
|
|
1678
|
+
">",
|
|
1679
|
+
"<",
|
|
1680
|
+
">=",
|
|
1681
|
+
"<=",
|
|
1682
|
+
"||",
|
|
1683
|
+
"&&",
|
|
1684
|
+
"??",
|
|
1685
|
+
"&",
|
|
1686
|
+
"===",
|
|
1687
|
+
"!==",
|
|
1688
|
+
"|",
|
|
1689
|
+
"|>"
|
|
1690
|
+
];
|
|
1691
|
+
var PRECEDENCE = {
|
|
1692
|
+
"!": 0,
|
|
1693
|
+
":": 0,
|
|
1694
|
+
",": 0,
|
|
1695
|
+
")": 0,
|
|
1696
|
+
"]": 0,
|
|
1697
|
+
"}": 0,
|
|
1698
|
+
"|>": 1,
|
|
1699
|
+
"?": 2,
|
|
1700
|
+
"??": 3,
|
|
1701
|
+
"||": 4,
|
|
1702
|
+
"&&": 5,
|
|
1703
|
+
"|": 6,
|
|
1704
|
+
"^": 7,
|
|
1705
|
+
"&": 8,
|
|
1706
|
+
// equality
|
|
1707
|
+
"!=": 9,
|
|
1708
|
+
"==": 9,
|
|
1709
|
+
"!==": 9,
|
|
1710
|
+
"===": 9,
|
|
1711
|
+
// relational
|
|
1712
|
+
">=": 10,
|
|
1713
|
+
">": 10,
|
|
1714
|
+
"<=": 10,
|
|
1715
|
+
"<": 10,
|
|
1716
|
+
// additive
|
|
1717
|
+
"+": 11,
|
|
1718
|
+
"-": 11,
|
|
1719
|
+
// multiplicative
|
|
1720
|
+
"%": 12,
|
|
1721
|
+
"/": 12,
|
|
1722
|
+
"*": 12,
|
|
1723
|
+
// postfix
|
|
1724
|
+
"(": 13,
|
|
1725
|
+
"[": 13,
|
|
1726
|
+
".": 13,
|
|
1727
|
+
"{": 13
|
|
1728
|
+
// not sure this is correct
|
|
1729
|
+
};
|
|
1730
|
+
var POSTFIX_PRECEDENCE = 13;
|
|
1731
|
+
|
|
1732
|
+
// ../../node_modules/.pnpm/@heximal+expressions@0.1.5/node_modules/@heximal/expressions/lib/tokenizer.js
|
|
1733
|
+
var TWO_CHAR_OPS = ["==", "!=", "<=", ">=", "||", "&&", "??", "|>"];
|
|
1734
|
+
var THREE_CHAR_OPS = ["===", "!=="];
|
|
1735
|
+
var Kind;
|
|
1736
|
+
(function(Kind2) {
|
|
1737
|
+
Kind2[Kind2["STRING"] = 1] = "STRING";
|
|
1738
|
+
Kind2[Kind2["IDENTIFIER"] = 2] = "IDENTIFIER";
|
|
1739
|
+
Kind2[Kind2["DOT"] = 3] = "DOT";
|
|
1740
|
+
Kind2[Kind2["COMMA"] = 4] = "COMMA";
|
|
1741
|
+
Kind2[Kind2["COLON"] = 5] = "COLON";
|
|
1742
|
+
Kind2[Kind2["INTEGER"] = 6] = "INTEGER";
|
|
1743
|
+
Kind2[Kind2["DECIMAL"] = 7] = "DECIMAL";
|
|
1744
|
+
Kind2[Kind2["OPERATOR"] = 8] = "OPERATOR";
|
|
1745
|
+
Kind2[Kind2["GROUPER"] = 9] = "GROUPER";
|
|
1746
|
+
Kind2[Kind2["KEYWORD"] = 10] = "KEYWORD";
|
|
1747
|
+
Kind2[Kind2["ARROW"] = 11] = "ARROW";
|
|
1748
|
+
})(Kind || (Kind = {}));
|
|
1749
|
+
var token = (kind, value, precedence = 0) => ({
|
|
1750
|
+
kind,
|
|
1751
|
+
value,
|
|
1752
|
+
precedence
|
|
1753
|
+
});
|
|
1754
|
+
var isWhitespace = (ch) => ch === 9 || ch === 10 || ch === 13 || ch === 32;
|
|
1755
|
+
var isIdentOrKeywordStart = (ch) => ch === 95 || ch === 36 || // ch &= ~32 puts ch into the range [65,90] [A-Z] only if ch was already in
|
|
1756
|
+
// the that range or in the range [97,122] [a-z]. We must mutate ch only after
|
|
1757
|
+
// checking other characters, thus the comma operator.
|
|
1758
|
+
(ch &= ~32, 65 <= ch && ch <= 90);
|
|
1759
|
+
var isIdentifier = (ch) => isIdentOrKeywordStart(ch) || isNumber(ch);
|
|
1760
|
+
var isKeyword = (str) => KEYWORDS.indexOf(str) !== -1;
|
|
1761
|
+
var isQuote = (ch) => ch === 34 || ch === 39;
|
|
1762
|
+
var isNumber = (ch) => 48 <= ch && ch <= 57;
|
|
1763
|
+
var isOperator = (ch) => ch === 43 || ch === 45 || ch === 42 || ch === 47 || ch === 33 || ch === 38 || ch === 37 || ch === 60 || ch === 61 || ch === 62 || ch === 63 || ch === 94 || ch === 124;
|
|
1764
|
+
var _isGrouper = (ch) => ch === 40 || ch === 41 || ch === 91 || ch === 93 || ch === 123 || ch === 125;
|
|
1765
|
+
var escapeString = (str) => str.replace(/\\(.)/g, (_match, group) => {
|
|
1766
|
+
switch (group) {
|
|
1767
|
+
case "n":
|
|
1768
|
+
return "\n";
|
|
1769
|
+
case "r":
|
|
1770
|
+
return "\r";
|
|
1771
|
+
case "t":
|
|
1772
|
+
return " ";
|
|
1773
|
+
case "b":
|
|
1774
|
+
return "\b";
|
|
1775
|
+
case "f":
|
|
1776
|
+
return "\f";
|
|
1777
|
+
default:
|
|
1778
|
+
return group;
|
|
1779
|
+
}
|
|
1780
|
+
});
|
|
1781
|
+
var Tokenizer = class {
|
|
1782
|
+
#input;
|
|
1783
|
+
#index = -1;
|
|
1784
|
+
#tokenStart = 0;
|
|
1785
|
+
#next;
|
|
1786
|
+
constructor(input) {
|
|
1787
|
+
this.#input = input;
|
|
1788
|
+
this.#advance();
|
|
1789
|
+
}
|
|
1790
|
+
nextToken() {
|
|
1791
|
+
while (isWhitespace(this.#next)) {
|
|
1792
|
+
this.#advance(true);
|
|
1793
|
+
}
|
|
1794
|
+
if (isQuote(this.#next))
|
|
1795
|
+
return this.#tokenizeString();
|
|
1796
|
+
if (isIdentOrKeywordStart(this.#next)) {
|
|
1797
|
+
return this.#tokenizeIdentOrKeyword();
|
|
1798
|
+
}
|
|
1799
|
+
if (isNumber(this.#next))
|
|
1800
|
+
return this.#tokenizeNumber();
|
|
1801
|
+
if (this.#next === 46)
|
|
1802
|
+
return this.#tokenizeDot();
|
|
1803
|
+
if (this.#next === 44)
|
|
1804
|
+
return this.#tokenizeComma();
|
|
1805
|
+
if (this.#next === 58)
|
|
1806
|
+
return this.#tokenizeColon();
|
|
1807
|
+
if (isOperator(this.#next))
|
|
1808
|
+
return this.#tokenizeOperator();
|
|
1809
|
+
if (_isGrouper(this.#next))
|
|
1810
|
+
return this.#tokenizeGrouper();
|
|
1811
|
+
this.#advance();
|
|
1812
|
+
if (this.#next !== void 0) {
|
|
1813
|
+
throw new Error(`Expected end of input, got ${this.#next}`);
|
|
1814
|
+
}
|
|
1815
|
+
return void 0;
|
|
1816
|
+
}
|
|
1817
|
+
#advance(resetTokenStart) {
|
|
1818
|
+
this.#index++;
|
|
1819
|
+
if (this.#index < this.#input.length) {
|
|
1820
|
+
this.#next = this.#input.charCodeAt(this.#index);
|
|
1821
|
+
if (resetTokenStart === true) {
|
|
1822
|
+
this.#tokenStart = this.#index;
|
|
1823
|
+
}
|
|
1824
|
+
} else {
|
|
1825
|
+
this.#next = void 0;
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
#getValue(lookahead = 0) {
|
|
1829
|
+
const v = this.#input.substring(this.#tokenStart, this.#index + lookahead);
|
|
1830
|
+
if (lookahead === 0) {
|
|
1831
|
+
this.#clearValue();
|
|
1832
|
+
}
|
|
1833
|
+
return v;
|
|
1834
|
+
}
|
|
1835
|
+
#clearValue() {
|
|
1836
|
+
this.#tokenStart = this.#index;
|
|
1837
|
+
}
|
|
1838
|
+
#tokenizeString() {
|
|
1839
|
+
const _us = "unterminated string";
|
|
1840
|
+
const quoteChar = this.#next;
|
|
1841
|
+
this.#advance(true);
|
|
1842
|
+
while (this.#next !== quoteChar) {
|
|
1843
|
+
if (this.#next === void 0)
|
|
1844
|
+
throw new Error(_us);
|
|
1845
|
+
if (this.#next === 92) {
|
|
1846
|
+
this.#advance();
|
|
1847
|
+
if (this.#next === void 0)
|
|
1848
|
+
throw new Error(_us);
|
|
1849
|
+
}
|
|
1850
|
+
this.#advance();
|
|
1851
|
+
}
|
|
1852
|
+
const t2 = token(Kind.STRING, escapeString(this.#getValue()));
|
|
1853
|
+
this.#advance();
|
|
1854
|
+
return t2;
|
|
1855
|
+
}
|
|
1856
|
+
#tokenizeIdentOrKeyword() {
|
|
1857
|
+
do {
|
|
1858
|
+
this.#advance();
|
|
1859
|
+
} while (isIdentifier(this.#next));
|
|
1860
|
+
const value = this.#getValue();
|
|
1861
|
+
const kind = isKeyword(value) ? Kind.KEYWORD : Kind.IDENTIFIER;
|
|
1862
|
+
return token(kind, value);
|
|
1863
|
+
}
|
|
1864
|
+
#tokenizeNumber() {
|
|
1865
|
+
do {
|
|
1866
|
+
this.#advance();
|
|
1867
|
+
} while (isNumber(this.#next));
|
|
1868
|
+
if (this.#next === 46)
|
|
1869
|
+
return this.#tokenizeDot();
|
|
1870
|
+
return token(Kind.INTEGER, this.#getValue());
|
|
1871
|
+
}
|
|
1872
|
+
#tokenizeDot() {
|
|
1873
|
+
this.#advance();
|
|
1874
|
+
if (isNumber(this.#next))
|
|
1875
|
+
return this.#tokenizeFraction();
|
|
1876
|
+
this.#clearValue();
|
|
1877
|
+
return token(Kind.DOT, ".", POSTFIX_PRECEDENCE);
|
|
1878
|
+
}
|
|
1879
|
+
#tokenizeComma() {
|
|
1880
|
+
this.#advance(true);
|
|
1881
|
+
return token(Kind.COMMA, ",");
|
|
1882
|
+
}
|
|
1883
|
+
#tokenizeColon() {
|
|
1884
|
+
this.#advance(true);
|
|
1885
|
+
return token(Kind.COLON, ":");
|
|
1886
|
+
}
|
|
1887
|
+
#tokenizeFraction() {
|
|
1888
|
+
do {
|
|
1889
|
+
this.#advance();
|
|
1890
|
+
} while (isNumber(this.#next));
|
|
1891
|
+
return token(Kind.DECIMAL, this.#getValue());
|
|
1892
|
+
}
|
|
1893
|
+
#tokenizeOperator() {
|
|
1894
|
+
this.#advance();
|
|
1895
|
+
let op = this.#getValue(2);
|
|
1896
|
+
if (THREE_CHAR_OPS.indexOf(op) !== -1) {
|
|
1897
|
+
this.#advance();
|
|
1898
|
+
this.#advance();
|
|
1899
|
+
} else {
|
|
1900
|
+
op = this.#getValue(1);
|
|
1901
|
+
if (op === "=>") {
|
|
1902
|
+
this.#advance();
|
|
1903
|
+
return token(Kind.ARROW, op);
|
|
1904
|
+
}
|
|
1905
|
+
if (TWO_CHAR_OPS.indexOf(op) !== -1) {
|
|
1906
|
+
this.#advance();
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
op = this.#getValue();
|
|
1910
|
+
return token(Kind.OPERATOR, op, PRECEDENCE[op]);
|
|
1911
|
+
}
|
|
1912
|
+
#tokenizeGrouper() {
|
|
1913
|
+
const value = String.fromCharCode(this.#next);
|
|
1914
|
+
const t2 = token(Kind.GROUPER, value, PRECEDENCE[value]);
|
|
1915
|
+
this.#advance(true);
|
|
1916
|
+
return t2;
|
|
1917
|
+
}
|
|
1918
|
+
};
|
|
1919
|
+
|
|
1920
|
+
// ../../node_modules/.pnpm/@heximal+expressions@0.1.5/node_modules/@heximal/expressions/lib/parser.js
|
|
1921
|
+
var parse = (expr, astFactory2) => new Parser(expr, astFactory2).parse();
|
|
1922
|
+
var Parser = class {
|
|
1923
|
+
#kind;
|
|
1924
|
+
#tokenizer;
|
|
1925
|
+
#ast;
|
|
1926
|
+
#token;
|
|
1927
|
+
#value;
|
|
1928
|
+
constructor(input, astFactory2) {
|
|
1929
|
+
this.#tokenizer = new Tokenizer(input);
|
|
1930
|
+
this.#ast = astFactory2;
|
|
1931
|
+
}
|
|
1932
|
+
parse() {
|
|
1933
|
+
this.#advance();
|
|
1934
|
+
return this.#parseExpression();
|
|
1935
|
+
}
|
|
1936
|
+
#advance(kind, value) {
|
|
1937
|
+
if (!this._matches(kind, value)) {
|
|
1938
|
+
throw new Error(`Expected kind ${kind} (${value}), was ${this.#token?.kind} (${this.#token?.value})`);
|
|
1939
|
+
}
|
|
1940
|
+
const t2 = this.#tokenizer.nextToken();
|
|
1941
|
+
this.#token = t2;
|
|
1942
|
+
this.#kind = t2?.kind;
|
|
1943
|
+
this.#value = t2?.value;
|
|
1944
|
+
}
|
|
1945
|
+
_matches(kind, value) {
|
|
1946
|
+
return !(kind && this.#kind !== kind || value && this.#value !== value);
|
|
1947
|
+
}
|
|
1948
|
+
#parseExpression() {
|
|
1949
|
+
if (!this.#token)
|
|
1950
|
+
return this.#ast.empty();
|
|
1951
|
+
const expr = this.#parseUnary();
|
|
1952
|
+
return expr === void 0 ? void 0 : this.#parsePrecedence(expr, 0);
|
|
1953
|
+
}
|
|
1954
|
+
// #parsePrecedence and #parseBinary implement the precedence climbing
|
|
1955
|
+
// algorithm as described in:
|
|
1956
|
+
// http://en.wikipedia.org/wiki/Operator-precedence_parser#Precedence_climbing_method
|
|
1957
|
+
#parsePrecedence(left, precedence) {
|
|
1958
|
+
if (left === void 0) {
|
|
1959
|
+
throw new Error("Expected left to be defined.");
|
|
1960
|
+
}
|
|
1961
|
+
while (this.#token) {
|
|
1962
|
+
if (this._matches(Kind.GROUPER, "(")) {
|
|
1963
|
+
const args = this.#parseArguments();
|
|
1964
|
+
left = this.#ast.invoke(left, void 0, args);
|
|
1965
|
+
} else if (this._matches(Kind.GROUPER, "[")) {
|
|
1966
|
+
const indexExpr = this.#parseIndex();
|
|
1967
|
+
left = this.#ast.index(left, indexExpr);
|
|
1968
|
+
} else if (this._matches(Kind.DOT)) {
|
|
1969
|
+
this.#advance();
|
|
1970
|
+
const right = this.#parseUnary();
|
|
1971
|
+
left = this.#makeInvokeOrGetter(left, right);
|
|
1972
|
+
} else if (this._matches(Kind.KEYWORD)) {
|
|
1973
|
+
break;
|
|
1974
|
+
} else if (this._matches(Kind.OPERATOR) && this.#token.precedence >= precedence) {
|
|
1975
|
+
left = this.#value === "?" ? this.#parseTernary(left) : this.#parseBinary(left, this.#token);
|
|
1976
|
+
} else {
|
|
1977
|
+
break;
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
return left;
|
|
1981
|
+
}
|
|
1982
|
+
#makeInvokeOrGetter(left, right) {
|
|
1983
|
+
if (right === void 0) {
|
|
1984
|
+
throw new Error("expected identifier");
|
|
1985
|
+
}
|
|
1986
|
+
if (right.type === "ID") {
|
|
1987
|
+
return this.#ast.getter(left, right.value);
|
|
1988
|
+
} else if (right.type === "Invoke" && right.receiver.type === "ID") {
|
|
1989
|
+
const method = right.receiver;
|
|
1990
|
+
return this.#ast.invoke(left, method.value, right.arguments);
|
|
1991
|
+
} else {
|
|
1992
|
+
throw new Error(`expected identifier: ${right}`);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
#parseBinary(left, op) {
|
|
1996
|
+
if (BINARY_OPERATORS.indexOf(op.value) === -1) {
|
|
1997
|
+
throw new Error(`unknown operator: ${op.value}`);
|
|
1998
|
+
}
|
|
1999
|
+
this.#advance();
|
|
2000
|
+
let right = this.#parseUnary();
|
|
2001
|
+
while ((this.#kind === Kind.OPERATOR || this.#kind === Kind.DOT || this.#kind === Kind.GROUPER) && this.#token.precedence > op.precedence) {
|
|
2002
|
+
right = this.#parsePrecedence(right, this.#token.precedence);
|
|
2003
|
+
}
|
|
2004
|
+
return this.#ast.binary(left, op.value, right);
|
|
2005
|
+
}
|
|
2006
|
+
#parseUnary() {
|
|
2007
|
+
if (this._matches(Kind.OPERATOR)) {
|
|
2008
|
+
const value = this.#value;
|
|
2009
|
+
this.#advance();
|
|
2010
|
+
if (value === "+" || value === "-") {
|
|
2011
|
+
if (this._matches(Kind.INTEGER)) {
|
|
2012
|
+
return this.#parseInteger(value);
|
|
2013
|
+
} else if (this._matches(Kind.DECIMAL)) {
|
|
2014
|
+
return this.#parseDecimal(value);
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
if (UNARY_OPERATORS.indexOf(value) === -1)
|
|
2018
|
+
throw new Error(`unexpected token: ${value}`);
|
|
2019
|
+
const expr = this.#parsePrecedence(this.#parsePrimary(), POSTFIX_PRECEDENCE);
|
|
2020
|
+
return this.#ast.unary(value, expr);
|
|
2021
|
+
}
|
|
2022
|
+
return this.#parsePrimary();
|
|
2023
|
+
}
|
|
2024
|
+
#parseTernary(condition) {
|
|
2025
|
+
this.#advance(Kind.OPERATOR, "?");
|
|
2026
|
+
const trueExpr = this.#parseExpression();
|
|
2027
|
+
this.#advance(Kind.COLON);
|
|
2028
|
+
const falseExpr = this.#parseExpression();
|
|
2029
|
+
return this.#ast.ternary(condition, trueExpr, falseExpr);
|
|
2030
|
+
}
|
|
2031
|
+
#parsePrimary() {
|
|
2032
|
+
switch (this.#kind) {
|
|
2033
|
+
case Kind.KEYWORD:
|
|
2034
|
+
const keyword = this.#value;
|
|
2035
|
+
if (keyword === "this") {
|
|
2036
|
+
this.#advance();
|
|
2037
|
+
return this.#ast.id(keyword);
|
|
2038
|
+
} else if (KEYWORDS.indexOf(keyword) !== -1) {
|
|
2039
|
+
throw new Error(`unexpected keyword: ${keyword}`);
|
|
2040
|
+
}
|
|
2041
|
+
throw new Error(`unrecognized keyword: ${keyword}`);
|
|
2042
|
+
case Kind.IDENTIFIER:
|
|
2043
|
+
return this.#parseInvokeOrIdentifier();
|
|
2044
|
+
case Kind.STRING:
|
|
2045
|
+
return this.#parseString();
|
|
2046
|
+
case Kind.INTEGER:
|
|
2047
|
+
return this.#parseInteger();
|
|
2048
|
+
case Kind.DECIMAL:
|
|
2049
|
+
return this.#parseDecimal();
|
|
2050
|
+
case Kind.GROUPER:
|
|
2051
|
+
if (this.#value === "(") {
|
|
2052
|
+
return this.#parseParenOrFunction();
|
|
2053
|
+
} else if (this.#value === "{") {
|
|
2054
|
+
return this.#parseMap();
|
|
2055
|
+
} else if (this.#value === "[") {
|
|
2056
|
+
return this.#parseList();
|
|
2057
|
+
}
|
|
2058
|
+
return void 0;
|
|
2059
|
+
case Kind.COLON:
|
|
2060
|
+
throw new Error('unexpected token ":"');
|
|
2061
|
+
default:
|
|
2062
|
+
return void 0;
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
#parseList() {
|
|
2066
|
+
const items = [];
|
|
2067
|
+
do {
|
|
2068
|
+
this.#advance();
|
|
2069
|
+
if (this._matches(Kind.GROUPER, "]"))
|
|
2070
|
+
break;
|
|
2071
|
+
items.push(this.#parseExpression());
|
|
2072
|
+
} while (this._matches(Kind.COMMA));
|
|
2073
|
+
this.#advance(Kind.GROUPER, "]");
|
|
2074
|
+
return this.#ast.list(items);
|
|
2075
|
+
}
|
|
2076
|
+
#parseMap() {
|
|
2077
|
+
const entries = {};
|
|
2078
|
+
do {
|
|
2079
|
+
this.#advance();
|
|
2080
|
+
if (this._matches(Kind.GROUPER, "}"))
|
|
2081
|
+
break;
|
|
2082
|
+
const key = this.#value;
|
|
2083
|
+
if (this._matches(Kind.STRING) || this._matches(Kind.IDENTIFIER)) {
|
|
2084
|
+
this.#advance();
|
|
2085
|
+
}
|
|
2086
|
+
this.#advance(Kind.COLON);
|
|
2087
|
+
entries[key] = this.#parseExpression();
|
|
2088
|
+
} while (this._matches(Kind.COMMA));
|
|
2089
|
+
this.#advance(Kind.GROUPER, "}");
|
|
2090
|
+
return this.#ast.map(entries);
|
|
2091
|
+
}
|
|
2092
|
+
#parseInvokeOrIdentifier() {
|
|
2093
|
+
const value = this.#value;
|
|
2094
|
+
if (value === "true") {
|
|
2095
|
+
this.#advance();
|
|
2096
|
+
return this.#ast.literal(true);
|
|
2097
|
+
}
|
|
2098
|
+
if (value === "false") {
|
|
2099
|
+
this.#advance();
|
|
2100
|
+
return this.#ast.literal(false);
|
|
2101
|
+
}
|
|
2102
|
+
if (value === "null") {
|
|
2103
|
+
this.#advance();
|
|
2104
|
+
return this.#ast.literal(null);
|
|
2105
|
+
}
|
|
2106
|
+
if (value === "undefined") {
|
|
2107
|
+
this.#advance();
|
|
2108
|
+
return this.#ast.literal(void 0);
|
|
2109
|
+
}
|
|
2110
|
+
const identifier = this.#parseIdentifier();
|
|
2111
|
+
const args = this.#parseArguments();
|
|
2112
|
+
return !args ? identifier : this.#ast.invoke(identifier, void 0, args);
|
|
2113
|
+
}
|
|
2114
|
+
#parseIdentifier() {
|
|
2115
|
+
if (!this._matches(Kind.IDENTIFIER)) {
|
|
2116
|
+
throw new Error(`expected identifier: ${this.#value}`);
|
|
2117
|
+
}
|
|
2118
|
+
const value = this.#value;
|
|
2119
|
+
this.#advance();
|
|
2120
|
+
return this.#ast.id(value);
|
|
2121
|
+
}
|
|
2122
|
+
#parseArguments() {
|
|
2123
|
+
if (!this._matches(Kind.GROUPER, "(")) {
|
|
2124
|
+
return void 0;
|
|
2125
|
+
}
|
|
2126
|
+
const args = [];
|
|
2127
|
+
do {
|
|
2128
|
+
this.#advance();
|
|
2129
|
+
if (this._matches(Kind.GROUPER, ")")) {
|
|
2130
|
+
break;
|
|
2131
|
+
}
|
|
2132
|
+
const expr = this.#parseExpression();
|
|
2133
|
+
args.push(expr);
|
|
2134
|
+
} while (this._matches(Kind.COMMA));
|
|
2135
|
+
this.#advance(Kind.GROUPER, ")");
|
|
2136
|
+
return args;
|
|
2137
|
+
}
|
|
2138
|
+
#parseIndex() {
|
|
2139
|
+
this.#advance();
|
|
2140
|
+
const expr = this.#parseExpression();
|
|
2141
|
+
this.#advance(Kind.GROUPER, "]");
|
|
2142
|
+
return expr;
|
|
2143
|
+
}
|
|
2144
|
+
#parseParenOrFunction() {
|
|
2145
|
+
const expressions = this.#parseArguments();
|
|
2146
|
+
if (this._matches(Kind.ARROW)) {
|
|
2147
|
+
this.#advance();
|
|
2148
|
+
const body = this.#parseExpression();
|
|
2149
|
+
const params = expressions?.map((e2) => e2.value) ?? [];
|
|
2150
|
+
return this.#ast.arrowFunction(params, body);
|
|
2151
|
+
} else {
|
|
2152
|
+
return this.#ast.paren(expressions[0]);
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
#parseString() {
|
|
2156
|
+
const value = this.#ast.literal(this.#value);
|
|
2157
|
+
this.#advance();
|
|
2158
|
+
return value;
|
|
2159
|
+
}
|
|
2160
|
+
#parseInteger(prefix = "") {
|
|
2161
|
+
const value = this.#ast.literal(parseInt(`${prefix}${this.#value}`, 10));
|
|
2162
|
+
this.#advance();
|
|
2163
|
+
return value;
|
|
2164
|
+
}
|
|
2165
|
+
#parseDecimal(prefix = "") {
|
|
2166
|
+
const value = this.#ast.literal(parseFloat(`${prefix}${this.#value}`));
|
|
2167
|
+
this.#advance();
|
|
2168
|
+
return value;
|
|
2169
|
+
}
|
|
2170
|
+
};
|
|
2171
|
+
|
|
2172
|
+
// ../../node_modules/.pnpm/@heximal+expressions@0.1.5/node_modules/@heximal/expressions/lib/eval.js
|
|
2173
|
+
var { hasOwn, fromEntries } = Object;
|
|
2174
|
+
var _BINARY_OPERATORS = {
|
|
2175
|
+
"+": (a, b) => a + b,
|
|
2176
|
+
"-": (a, b) => a - b,
|
|
2177
|
+
"*": (a, b) => a * b,
|
|
2178
|
+
"/": (a, b) => a / b,
|
|
2179
|
+
"%": (a, b) => a % b,
|
|
2180
|
+
"==": (a, b) => a == b,
|
|
2181
|
+
"!=": (a, b) => a != b,
|
|
2182
|
+
"===": (a, b) => a === b,
|
|
2183
|
+
"!==": (a, b) => a !== b,
|
|
2184
|
+
">": (a, b) => a > b,
|
|
2185
|
+
">=": (a, b) => a >= b,
|
|
2186
|
+
"<": (a, b) => a < b,
|
|
2187
|
+
"<=": (a, b) => a <= b,
|
|
2188
|
+
"||": (a, b) => a || b,
|
|
2189
|
+
"&&": (a, b) => a && b,
|
|
2190
|
+
"??": (a, b) => a ?? b,
|
|
2191
|
+
"|": (a, f) => f(a),
|
|
2192
|
+
"|>": (a, f) => f(a)
|
|
2193
|
+
};
|
|
2194
|
+
var _UNARY_OPERATORS = {
|
|
2195
|
+
"+": (a) => a,
|
|
2196
|
+
"-": (a) => -a,
|
|
2197
|
+
"!": (a) => !a
|
|
2198
|
+
};
|
|
2199
|
+
var EvalAstFactory = class {
|
|
2200
|
+
empty() {
|
|
2201
|
+
return {
|
|
2202
|
+
type: "Empty",
|
|
2203
|
+
evaluate(scope) {
|
|
2204
|
+
return scope;
|
|
2205
|
+
},
|
|
2206
|
+
getIds(idents) {
|
|
2207
|
+
return idents;
|
|
2208
|
+
}
|
|
2209
|
+
};
|
|
2210
|
+
}
|
|
2211
|
+
// TODO(justinfagnani): just use a JS literal?
|
|
2212
|
+
literal(v) {
|
|
2213
|
+
return {
|
|
2214
|
+
type: "Literal",
|
|
2215
|
+
value: v,
|
|
2216
|
+
evaluate(_scope) {
|
|
2217
|
+
return this.value;
|
|
2218
|
+
},
|
|
2219
|
+
getIds(idents) {
|
|
2220
|
+
return idents;
|
|
2221
|
+
}
|
|
2222
|
+
};
|
|
2223
|
+
}
|
|
2224
|
+
id(v) {
|
|
2225
|
+
return {
|
|
2226
|
+
type: "ID",
|
|
2227
|
+
value: v,
|
|
2228
|
+
evaluate(scope) {
|
|
2229
|
+
if (this.value === "this")
|
|
2230
|
+
return scope;
|
|
2231
|
+
return scope?.[this.value];
|
|
2232
|
+
},
|
|
2233
|
+
getIds(idents) {
|
|
2234
|
+
idents.push(this.value);
|
|
2235
|
+
return idents;
|
|
2236
|
+
}
|
|
2237
|
+
};
|
|
2238
|
+
}
|
|
2239
|
+
unary(op, expr) {
|
|
2240
|
+
const f = _UNARY_OPERATORS[op];
|
|
2241
|
+
return {
|
|
2242
|
+
type: "Unary",
|
|
2243
|
+
operator: op,
|
|
2244
|
+
child: expr,
|
|
2245
|
+
evaluate(scope) {
|
|
2246
|
+
return f(this.child.evaluate(scope));
|
|
2247
|
+
},
|
|
2248
|
+
getIds(idents) {
|
|
2249
|
+
return this.child.getIds(idents);
|
|
2250
|
+
}
|
|
2251
|
+
};
|
|
2252
|
+
}
|
|
2253
|
+
binary(l, op, r3) {
|
|
2254
|
+
const f = _BINARY_OPERATORS[op];
|
|
2255
|
+
return {
|
|
2256
|
+
type: "Binary",
|
|
2257
|
+
operator: op,
|
|
2258
|
+
left: l,
|
|
2259
|
+
right: r3,
|
|
2260
|
+
evaluate(scope) {
|
|
2261
|
+
if (this.operator === "=") {
|
|
2262
|
+
if (this.left.type !== "ID" && this.left.type !== "Getter" && this.left.type !== "Index") {
|
|
2263
|
+
throw new Error(`Invalid assignment target: ${this.left}`);
|
|
2264
|
+
}
|
|
2265
|
+
const value = this.right.evaluate(scope);
|
|
2266
|
+
let receiver = void 0;
|
|
2267
|
+
let property;
|
|
2268
|
+
if (this.left.type === "Getter") {
|
|
2269
|
+
receiver = this.left.receiver.evaluate(scope);
|
|
2270
|
+
property = this.left.name;
|
|
2271
|
+
} else if (this.left.type === "Index") {
|
|
2272
|
+
receiver = this.left.receiver.evaluate(scope);
|
|
2273
|
+
property = this.left.argument.evaluate(scope);
|
|
2274
|
+
} else if (this.left.type === "ID") {
|
|
2275
|
+
receiver = scope;
|
|
2276
|
+
property = this.left.value;
|
|
2277
|
+
}
|
|
2278
|
+
return receiver === void 0 ? void 0 : receiver[property] = value;
|
|
2279
|
+
}
|
|
2280
|
+
return f(this.left.evaluate(scope), this.right.evaluate(scope));
|
|
2281
|
+
},
|
|
2282
|
+
getIds(idents) {
|
|
2283
|
+
this.left.getIds(idents);
|
|
2284
|
+
this.right.getIds(idents);
|
|
2285
|
+
return idents;
|
|
2286
|
+
}
|
|
2287
|
+
};
|
|
2288
|
+
}
|
|
2289
|
+
getter(g, n2) {
|
|
2290
|
+
return {
|
|
2291
|
+
type: "Getter",
|
|
2292
|
+
receiver: g,
|
|
2293
|
+
name: n2,
|
|
2294
|
+
evaluate(scope) {
|
|
2295
|
+
return this.receiver.evaluate(scope)?.[this.name];
|
|
2296
|
+
},
|
|
2297
|
+
getIds(idents) {
|
|
2298
|
+
this.receiver.getIds(idents);
|
|
2299
|
+
return idents;
|
|
2300
|
+
}
|
|
2301
|
+
};
|
|
2302
|
+
}
|
|
2303
|
+
invoke(receiver, method, args) {
|
|
2304
|
+
if (method != null && typeof method !== "string") {
|
|
2305
|
+
throw new Error("method not a string");
|
|
2306
|
+
}
|
|
2307
|
+
return {
|
|
2308
|
+
type: "Invoke",
|
|
2309
|
+
receiver,
|
|
2310
|
+
method,
|
|
2311
|
+
arguments: args,
|
|
2312
|
+
evaluate(scope) {
|
|
2313
|
+
const receiver2 = this.receiver.evaluate(scope);
|
|
2314
|
+
const _this = this.method ? receiver2 : scope?.["this"] ?? scope;
|
|
2315
|
+
const f = this.method ? receiver2?.[method] : receiver2;
|
|
2316
|
+
const args2 = this.arguments ?? [];
|
|
2317
|
+
const argValues = args2.map((a) => a?.evaluate(scope));
|
|
2318
|
+
return f?.apply?.(_this, argValues);
|
|
2319
|
+
},
|
|
2320
|
+
getIds(idents) {
|
|
2321
|
+
this.receiver.getIds(idents);
|
|
2322
|
+
this.arguments?.forEach((a) => a?.getIds(idents));
|
|
2323
|
+
return idents;
|
|
2324
|
+
}
|
|
2325
|
+
};
|
|
2326
|
+
}
|
|
2327
|
+
paren(e2) {
|
|
2328
|
+
return e2;
|
|
2329
|
+
}
|
|
2330
|
+
index(e2, a) {
|
|
2331
|
+
return {
|
|
2332
|
+
type: "Index",
|
|
2333
|
+
receiver: e2,
|
|
2334
|
+
argument: a,
|
|
2335
|
+
evaluate(scope) {
|
|
2336
|
+
return this.receiver.evaluate(scope)?.[this.argument.evaluate(scope)];
|
|
2337
|
+
},
|
|
2338
|
+
getIds(idents) {
|
|
2339
|
+
this.receiver.getIds(idents);
|
|
2340
|
+
return idents;
|
|
2341
|
+
}
|
|
2342
|
+
};
|
|
2343
|
+
}
|
|
2344
|
+
ternary(c2, t2, f) {
|
|
2345
|
+
return {
|
|
2346
|
+
type: "Ternary",
|
|
2347
|
+
condition: c2,
|
|
2348
|
+
trueExpr: t2,
|
|
2349
|
+
falseExpr: f,
|
|
2350
|
+
evaluate(scope) {
|
|
2351
|
+
const c3 = this.condition.evaluate(scope);
|
|
2352
|
+
if (c3) {
|
|
2353
|
+
return this.trueExpr.evaluate(scope);
|
|
2354
|
+
} else {
|
|
2355
|
+
return this.falseExpr.evaluate(scope);
|
|
2356
|
+
}
|
|
2357
|
+
},
|
|
2358
|
+
getIds(idents) {
|
|
2359
|
+
this.condition.getIds(idents);
|
|
2360
|
+
this.trueExpr.getIds(idents);
|
|
2361
|
+
this.falseExpr.getIds(idents);
|
|
2362
|
+
return idents;
|
|
2363
|
+
}
|
|
2364
|
+
};
|
|
2365
|
+
}
|
|
2366
|
+
map(entries) {
|
|
2367
|
+
return {
|
|
2368
|
+
type: "Map",
|
|
2369
|
+
entries,
|
|
2370
|
+
evaluate(scope) {
|
|
2371
|
+
const map = {};
|
|
2372
|
+
if (entries && this.entries) {
|
|
2373
|
+
for (const key in entries) {
|
|
2374
|
+
const val = this.entries[key];
|
|
2375
|
+
if (val) {
|
|
2376
|
+
map[key] = val.evaluate(scope);
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
return map;
|
|
2381
|
+
},
|
|
2382
|
+
getIds(idents) {
|
|
2383
|
+
if (entries && this.entries) {
|
|
2384
|
+
for (const key in entries) {
|
|
2385
|
+
const val = this.entries[key];
|
|
2386
|
+
if (val) {
|
|
2387
|
+
val.getIds(idents);
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
return idents;
|
|
2392
|
+
}
|
|
2393
|
+
};
|
|
2394
|
+
}
|
|
2395
|
+
// TODO(justinfagnani): if the list is deeply literal
|
|
2396
|
+
list(l) {
|
|
2397
|
+
return {
|
|
2398
|
+
type: "List",
|
|
2399
|
+
items: l,
|
|
2400
|
+
evaluate(scope) {
|
|
2401
|
+
return this.items?.map((a) => a?.evaluate(scope));
|
|
2402
|
+
},
|
|
2403
|
+
getIds(idents) {
|
|
2404
|
+
this.items?.forEach((i4) => i4?.getIds(idents));
|
|
2405
|
+
return idents;
|
|
2406
|
+
}
|
|
2407
|
+
};
|
|
2408
|
+
}
|
|
2409
|
+
arrowFunction(params, body) {
|
|
2410
|
+
return {
|
|
2411
|
+
type: "ArrowFunction",
|
|
2412
|
+
params,
|
|
2413
|
+
body,
|
|
2414
|
+
evaluate(scope) {
|
|
2415
|
+
const params2 = this.params;
|
|
2416
|
+
const body2 = this.body;
|
|
2417
|
+
return function(...args) {
|
|
2418
|
+
const paramsObj = fromEntries(params2.map((p, i4) => [p, args[i4]]));
|
|
2419
|
+
const newScope = new Proxy(scope ?? {}, {
|
|
2420
|
+
set(target, prop, value) {
|
|
2421
|
+
if (hasOwn(paramsObj, prop)) {
|
|
2422
|
+
paramsObj[prop] = value;
|
|
2423
|
+
}
|
|
2424
|
+
return target[prop] = value;
|
|
2425
|
+
},
|
|
2426
|
+
get(target, prop) {
|
|
2427
|
+
if (hasOwn(paramsObj, prop)) {
|
|
2428
|
+
return paramsObj[prop];
|
|
2429
|
+
}
|
|
2430
|
+
return target[prop];
|
|
2431
|
+
}
|
|
2432
|
+
});
|
|
2433
|
+
return body2.evaluate(newScope);
|
|
2434
|
+
};
|
|
2435
|
+
},
|
|
2436
|
+
getIds(idents) {
|
|
2437
|
+
return this.body.getIds(idents).filter((id) => !this.params.includes(id));
|
|
2438
|
+
}
|
|
2439
|
+
};
|
|
2440
|
+
}
|
|
2441
|
+
};
|
|
2442
|
+
|
|
2443
|
+
// ../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/node/private-ssr-support.js
|
|
2444
|
+
var r2 = null;
|
|
2445
|
+
var i3 = { boundAttributeSuffix: W.M, marker: W.P, markerMatch: W.A, HTML_RESULT: W.C, getTemplateHtml: W.L, overrideDirectiveResolve: (e2, t2) => class extends e2 {
|
|
2446
|
+
_$AS(e3, r3) {
|
|
2447
|
+
return t2(this, r3);
|
|
2448
|
+
}
|
|
2449
|
+
}, patchDirectiveResolve: (e2, t2) => {
|
|
2450
|
+
if (e2.prototype._$AS.name !== t2.name) {
|
|
2451
|
+
r2 ??= e2.prototype._$AS.name;
|
|
2452
|
+
for (let i4 = e2.prototype; i4 !== Object.prototype; i4 = Object.getPrototypeOf(i4)) if (i4.hasOwnProperty(r2)) return void (i4[r2] = t2);
|
|
2453
|
+
throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527");
|
|
2454
|
+
}
|
|
2455
|
+
}, setDirectiveClass(e2, t2) {
|
|
2456
|
+
e2._$litDirective$ = t2;
|
|
2457
|
+
}, getAttributePartCommittedValue: (e2, r3, i4) => {
|
|
2458
|
+
let o = w;
|
|
2459
|
+
return e2.j = (e3) => o = e3, e2._$AI(r3, e2, i4), o;
|
|
2460
|
+
}, connectedDisconnectable: (e2) => ({ ...e2, _$AU: true }), resolveDirective: W.V, AttributePart: W.H, PropertyPart: W.B, BooleanAttributePart: W.N, EventPart: W.U, ElementPart: W.F, TemplateInstance: W.R, isIterable: W.D, ChildPart: W.I };
|
|
2461
|
+
|
|
2462
|
+
// ../../node_modules/.pnpm/@heximal+templates@0.1.5/node_modules/@heximal/templates/index.js
|
|
2463
|
+
var { AttributePart, PropertyPart, BooleanAttributePart, EventPart } = i3;
|
|
2464
|
+
var astFactory = new EvalAstFactory();
|
|
2465
|
+
var expressionCache = /* @__PURE__ */ new Map();
|
|
2466
|
+
var toCamelCase = (s) => s.replace(/-(-|\w)/g, (_, p1) => p1.toUpperCase());
|
|
2467
|
+
var getSingleValue = (s, model) => {
|
|
2468
|
+
let ast = expressionCache.get(s);
|
|
2469
|
+
if (ast === void 0) {
|
|
2470
|
+
if (expressionCache.has(s)) {
|
|
2471
|
+
return void 0;
|
|
2472
|
+
}
|
|
2473
|
+
s = s.trim();
|
|
2474
|
+
if (s.startsWith("{{") && s.endsWith("}}")) {
|
|
2475
|
+
const expression = s.substring(2, s.length - 2).trim();
|
|
2476
|
+
ast = new Parser(expression, astFactory).parse();
|
|
2477
|
+
expressionCache.set(s, ast);
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
return ast?.evaluate(model);
|
|
2481
|
+
};
|
|
2482
|
+
var ifHandler = (template, model, handlers, renderers) => {
|
|
2483
|
+
const ifAttribute = template.getAttribute("if");
|
|
2484
|
+
if (ifAttribute !== null && getSingleValue(ifAttribute, model)) {
|
|
2485
|
+
return evaluateTemplate(template, model, handlers, renderers);
|
|
2486
|
+
}
|
|
2487
|
+
return void 0;
|
|
2488
|
+
};
|
|
2489
|
+
var bindingRegex = /(?<!\\){{(.*?)(?:(?<!\\)}})/g;
|
|
2490
|
+
var hasEscapedBindingMarkers = (s) => /(?:\\{{)|(?:\\}})/g.test(s);
|
|
2491
|
+
var unescapeBindingMarkers = (s) => s.replaceAll(/\\{{/g, "{{").replace(/\\}}/g, "}}");
|
|
2492
|
+
var repeatHandler = (template, model, handlers, renderers) => {
|
|
2493
|
+
const repeatAttribute = template.getAttribute("repeat");
|
|
2494
|
+
if (repeatAttribute !== null) {
|
|
2495
|
+
const items = getSingleValue(repeatAttribute, model);
|
|
2496
|
+
if (!items[Symbol.iterator]) {
|
|
2497
|
+
return E;
|
|
2498
|
+
}
|
|
2499
|
+
const litTemplate = getLitTemplate(template);
|
|
2500
|
+
let index = -1;
|
|
2501
|
+
const result = [];
|
|
2502
|
+
for (const item of items) {
|
|
2503
|
+
index++;
|
|
2504
|
+
const itemModel = Object.create(model);
|
|
2505
|
+
itemModel.item = item;
|
|
2506
|
+
itemModel.index = index;
|
|
2507
|
+
itemModel["this"] = model["this"] ?? model;
|
|
2508
|
+
const values = [];
|
|
2509
|
+
for (const part of litTemplate.parts) {
|
|
2510
|
+
const value = part.update(itemModel, handlers, renderers);
|
|
2511
|
+
if (part.type === 1) {
|
|
2512
|
+
values.push(...value);
|
|
2513
|
+
} else {
|
|
2514
|
+
values.push(value);
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
const templateResult = {
|
|
2518
|
+
_$litType$: litTemplate,
|
|
2519
|
+
values
|
|
2520
|
+
};
|
|
2521
|
+
result.push(templateResult);
|
|
2522
|
+
}
|
|
2523
|
+
return result;
|
|
2524
|
+
}
|
|
2525
|
+
return void 0;
|
|
2526
|
+
};
|
|
2527
|
+
var defaultHandlers = {
|
|
2528
|
+
if: ifHandler,
|
|
2529
|
+
repeat: repeatHandler
|
|
2530
|
+
};
|
|
2531
|
+
var prepareTemplate = (template, handlers = defaultHandlers, renderers = {}, superTemplate) => {
|
|
2532
|
+
const litTemplate = getLitTemplate(template);
|
|
2533
|
+
const templateRenderers = litTemplate.renderers;
|
|
2534
|
+
if (superTemplate) {
|
|
2535
|
+
const superLitTemplate = getLitTemplate(superTemplate);
|
|
2536
|
+
const superRenderers = superLitTemplate.renderers;
|
|
2537
|
+
const superCallRenderer = templateRenderers["super"];
|
|
2538
|
+
if (superCallRenderer !== void 0) {
|
|
2539
|
+
renderers = {
|
|
2540
|
+
// sub template's own renderes
|
|
2541
|
+
...templateRenderers,
|
|
2542
|
+
// passed-in renderers
|
|
2543
|
+
...renderers,
|
|
2544
|
+
// a super call renderer
|
|
2545
|
+
super: (model, handlers2, renderers2) => {
|
|
2546
|
+
renderers2 = {
|
|
2547
|
+
// super template's own blocks
|
|
2548
|
+
...superRenderers,
|
|
2549
|
+
// passed-in renderers
|
|
2550
|
+
...renderers2,
|
|
2551
|
+
// sub template's overrides will be added by the inner super call
|
|
2552
|
+
super: (model2, handlers3, renderers3) => {
|
|
2553
|
+
return evaluateTemplate(superTemplate, model2, handlers3, renderers3);
|
|
2554
|
+
}
|
|
2555
|
+
};
|
|
2556
|
+
return superCallRenderer(model, handlers2, renderers2);
|
|
2557
|
+
}
|
|
2558
|
+
};
|
|
2559
|
+
} else {
|
|
2560
|
+
renderers = {
|
|
2561
|
+
// super template's own blocks
|
|
2562
|
+
...superRenderers,
|
|
2563
|
+
// sub template's overrides
|
|
2564
|
+
...templateRenderers,
|
|
2565
|
+
// passed-in renderers
|
|
2566
|
+
...renderers
|
|
2567
|
+
};
|
|
2568
|
+
template = superTemplate;
|
|
2569
|
+
}
|
|
2570
|
+
} else {
|
|
2571
|
+
renderers = {
|
|
2572
|
+
// template's named blocks
|
|
2573
|
+
...templateRenderers,
|
|
2574
|
+
// passed-in renderers
|
|
2575
|
+
...renderers
|
|
2576
|
+
};
|
|
2577
|
+
}
|
|
2578
|
+
return (model) => evaluateTemplate(template, model, handlers, renderers);
|
|
2579
|
+
};
|
|
2580
|
+
var evaluateTemplate = (template, model, handlers = defaultHandlers, renderers = {}) => {
|
|
2581
|
+
const litTemplate = getLitTemplate(template);
|
|
2582
|
+
const values = [];
|
|
2583
|
+
for (const part of litTemplate.parts) {
|
|
2584
|
+
const value = part.update(model, handlers, renderers);
|
|
2585
|
+
if (part.type === 1) {
|
|
2586
|
+
values.push(...value);
|
|
2587
|
+
} else {
|
|
2588
|
+
values.push(value);
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
const templateResult = {
|
|
2592
|
+
_$litType$: litTemplate,
|
|
2593
|
+
values
|
|
2594
|
+
};
|
|
2595
|
+
return templateResult;
|
|
2596
|
+
};
|
|
2597
|
+
var litTemplateCache = /* @__PURE__ */ new Map();
|
|
2598
|
+
var getLitTemplate = (template) => {
|
|
2599
|
+
let litTemplate = litTemplateCache.get(template);
|
|
2600
|
+
if (litTemplate === void 0) {
|
|
2601
|
+
litTemplateCache.set(template, litTemplate = makeLitTemplate(template));
|
|
2602
|
+
}
|
|
2603
|
+
return litTemplate;
|
|
2604
|
+
};
|
|
2605
|
+
var makeLitTemplate = (template) => {
|
|
2606
|
+
const litTemplate = {
|
|
2607
|
+
h: void 0,
|
|
2608
|
+
el: template.cloneNode(true),
|
|
2609
|
+
parts: [],
|
|
2610
|
+
renderers: {}
|
|
2611
|
+
};
|
|
2612
|
+
const walker = document.createTreeWalker(litTemplate.el.content, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT);
|
|
2613
|
+
let node = walker.currentNode;
|
|
2614
|
+
let nodeIndex = -1;
|
|
2615
|
+
const elementsToRemove = [];
|
|
2616
|
+
while ((node = walker.nextNode()) !== null) {
|
|
2617
|
+
if (node.nodeType === Node.COMMENT_NODE) {
|
|
2618
|
+
nodeIndex++;
|
|
2619
|
+
} else if (node.nodeType === Node.ELEMENT_NODE) {
|
|
2620
|
+
nodeIndex++;
|
|
2621
|
+
const element = node;
|
|
2622
|
+
if (element.tagName === "TEMPLATE") {
|
|
2623
|
+
const type = element.getAttribute("type");
|
|
2624
|
+
const name = element.getAttribute("name");
|
|
2625
|
+
const call = element.getAttribute("call");
|
|
2626
|
+
if (call !== null || type !== null || name !== null) {
|
|
2627
|
+
element.parentNode.insertBefore(document.createComment(""), element);
|
|
2628
|
+
elementsToRemove.push(element);
|
|
2629
|
+
let update;
|
|
2630
|
+
if (call !== null) {
|
|
2631
|
+
const templateName = call.trim();
|
|
2632
|
+
const templateNameIsExpression = templateName.startsWith("{{") && templateName.endsWith("}}");
|
|
2633
|
+
update = (model, handlers, renderers) => {
|
|
2634
|
+
const dataAttr = element.getAttribute("data");
|
|
2635
|
+
const data = dataAttr === null ? void 0 : getSingleValue(dataAttr, model);
|
|
2636
|
+
const renderer = templateNameIsExpression ? getSingleValue(templateName, model) : renderers[call];
|
|
2637
|
+
return renderer?.(data, handlers, renderers);
|
|
2638
|
+
};
|
|
2639
|
+
} else if (type !== null) {
|
|
2640
|
+
update = (model, handlers, renderers) => {
|
|
2641
|
+
const handler = handlers[type];
|
|
2642
|
+
return handler?.(element, model, handlers, renderers);
|
|
2643
|
+
};
|
|
2644
|
+
} else {
|
|
2645
|
+
if (name === "super") {
|
|
2646
|
+
litTemplate.renderers["super"] = (model, handlers, renderers) => {
|
|
2647
|
+
const superRenderer = renderers["super"];
|
|
2648
|
+
const superCallTemplate = getLitTemplate(element);
|
|
2649
|
+
renderers = {
|
|
2650
|
+
...renderers,
|
|
2651
|
+
...superCallTemplate.renderers
|
|
2652
|
+
};
|
|
2653
|
+
return superRenderer(model, handlers, renderers);
|
|
2654
|
+
};
|
|
2655
|
+
} else {
|
|
2656
|
+
litTemplate.renderers[name] = (model, handlers, renderers) => {
|
|
2657
|
+
return evaluateTemplate(element, model, handlers, renderers);
|
|
2658
|
+
};
|
|
2659
|
+
}
|
|
2660
|
+
update = (model, handlers, renderers) => {
|
|
2661
|
+
const renderer = renderers[name];
|
|
2662
|
+
return renderer?.(model, handlers, renderers);
|
|
2663
|
+
};
|
|
2664
|
+
}
|
|
2665
|
+
litTemplate.parts.push({
|
|
2666
|
+
type: 2,
|
|
2667
|
+
// text binding
|
|
2668
|
+
index: nodeIndex,
|
|
2669
|
+
update
|
|
2670
|
+
});
|
|
2671
|
+
continue;
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
const attributeNames = element.getAttributeNames();
|
|
2675
|
+
for (const attributeName of attributeNames) {
|
|
2676
|
+
const attributeValue = element.getAttribute(attributeName);
|
|
2677
|
+
const splitValue = attributeValue.split(bindingRegex);
|
|
2678
|
+
if (splitValue.length === 1) {
|
|
2679
|
+
if (hasEscapedBindingMarkers(attributeValue)) {
|
|
2680
|
+
element.setAttribute(attributeName, unescapeBindingMarkers(attributeValue));
|
|
2681
|
+
}
|
|
2682
|
+
continue;
|
|
2683
|
+
}
|
|
2684
|
+
element.removeAttribute(attributeName);
|
|
2685
|
+
let name = attributeName;
|
|
2686
|
+
let ctor = AttributePart;
|
|
2687
|
+
const prefix = attributeName[0];
|
|
2688
|
+
if (prefix === ".") {
|
|
2689
|
+
name = toCamelCase(attributeName.substring(1));
|
|
2690
|
+
ctor = PropertyPart;
|
|
2691
|
+
} else if (prefix === "?") {
|
|
2692
|
+
name = attributeName.substring(1);
|
|
2693
|
+
ctor = BooleanAttributePart;
|
|
2694
|
+
} else if (prefix === "@") {
|
|
2695
|
+
name = toCamelCase(attributeName.substring(1));
|
|
2696
|
+
ctor = EventPart;
|
|
2697
|
+
}
|
|
2698
|
+
const strings = [unescapeBindingMarkers(splitValue[0])];
|
|
2699
|
+
const exprs = [];
|
|
2700
|
+
for (let i4 = 1; i4 < splitValue.length; i4 += 2) {
|
|
2701
|
+
const exprText = splitValue[i4];
|
|
2702
|
+
exprs.push(parse(exprText, astFactory));
|
|
2703
|
+
strings.push(unescapeBindingMarkers(splitValue[i4 + 1]));
|
|
2704
|
+
}
|
|
2705
|
+
litTemplate.parts.push({
|
|
2706
|
+
type: 1,
|
|
2707
|
+
// attribute binding
|
|
2708
|
+
index: nodeIndex,
|
|
2709
|
+
name,
|
|
2710
|
+
strings,
|
|
2711
|
+
ctor,
|
|
2712
|
+
update: (model, _handlers, _renderers) => {
|
|
2713
|
+
return exprs.map((expr) => expr.evaluate(model));
|
|
2714
|
+
}
|
|
2715
|
+
});
|
|
2716
|
+
}
|
|
2717
|
+
} else if (node.nodeType === Node.TEXT_NODE) {
|
|
2718
|
+
let textNode = node;
|
|
2719
|
+
const text = textNode.textContent;
|
|
2720
|
+
const strings = text.split(bindingRegex);
|
|
2721
|
+
if (strings.length > 1) {
|
|
2722
|
+
textNode.textContent = unescapeBindingMarkers(strings[0]);
|
|
2723
|
+
} else if (hasEscapedBindingMarkers(text)) {
|
|
2724
|
+
textNode.textContent = unescapeBindingMarkers(text);
|
|
2725
|
+
}
|
|
2726
|
+
for (let i4 = 1; i4 < strings.length; i4 += 2) {
|
|
2727
|
+
const exprText = strings[i4];
|
|
2728
|
+
const expr = parse(exprText, astFactory);
|
|
2729
|
+
litTemplate.parts.push({
|
|
2730
|
+
type: 2,
|
|
2731
|
+
index: ++nodeIndex,
|
|
2732
|
+
update: (model, _handlers) => expr.evaluate(model)
|
|
2733
|
+
});
|
|
2734
|
+
const newTextNode = new Text(strings[i4 + 1].replace("\\{{", "{{"));
|
|
2735
|
+
textNode.parentNode.insertBefore(newTextNode, textNode.nextSibling);
|
|
2736
|
+
textNode.parentNode.insertBefore(document.createComment(""), textNode.nextSibling);
|
|
2737
|
+
textNode = newTextNode;
|
|
2738
|
+
walker.currentNode = newTextNode;
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
for (const e2 of elementsToRemove) {
|
|
2743
|
+
e2.remove();
|
|
2744
|
+
}
|
|
2745
|
+
return litTemplate;
|
|
2746
|
+
};
|
|
2747
|
+
|
|
2748
|
+
// ../qti-test/src/components/test-paging-buttons-stamp/test-paging-buttons-stamp.ts
|
|
2749
|
+
var TestPagingButtonsStamp = class extends i2 {
|
|
1698
2750
|
createRenderRoot() {
|
|
1699
2751
|
return this;
|
|
1700
2752
|
}
|
|
@@ -1709,25 +2761,22 @@ var TestPagingButtonsStamp = class extends LitElement13 {
|
|
|
1709
2761
|
this.myTemplate = prepareTemplate(templateElement);
|
|
1710
2762
|
}
|
|
1711
2763
|
render() {
|
|
1712
|
-
if (!this.computedContext) return
|
|
2764
|
+
if (!this.computedContext) return x``;
|
|
1713
2765
|
const items = this.computedContext.testParts.flatMap(
|
|
1714
2766
|
(testPart) => testPart.sections.flatMap((section) => section.items)
|
|
1715
2767
|
);
|
|
1716
|
-
return
|
|
2768
|
+
return x` ${items.map((item) => this.myTemplate({ item, view: this.computedContext.view }))} `;
|
|
1717
2769
|
}
|
|
1718
2770
|
};
|
|
1719
2771
|
__decorateClass([
|
|
1720
|
-
|
|
2772
|
+
c({ context: computedContext, subscribe: true })
|
|
1721
2773
|
], TestPagingButtonsStamp.prototype, "computedContext", 2);
|
|
1722
2774
|
TestPagingButtonsStamp = __decorateClass([
|
|
1723
|
-
|
|
2775
|
+
t("test-paging-buttons-stamp")
|
|
1724
2776
|
], TestPagingButtonsStamp);
|
|
1725
2777
|
|
|
1726
|
-
//
|
|
1727
|
-
|
|
1728
|
-
import { customElement as customElement13, property as property13, state as state3 } from "lit/decorators.js";
|
|
1729
|
-
import { until } from "lit/directives/until.js";
|
|
1730
|
-
var TestContainer = class extends LitElement14 {
|
|
2778
|
+
// ../qti-test/src/components/test-container/test-container.ts
|
|
2779
|
+
var TestContainer = class extends i2 {
|
|
1731
2780
|
constructor() {
|
|
1732
2781
|
super(...arguments);
|
|
1733
2782
|
this.testURL = null;
|
|
@@ -1774,7 +2823,7 @@ var TestContainer = class extends LitElement14 {
|
|
|
1774
2823
|
}
|
|
1775
2824
|
initializeTemplateContent() {
|
|
1776
2825
|
const template = this.querySelector("template");
|
|
1777
|
-
this.templateContent = template ? template.content :
|
|
2826
|
+
this.templateContent = template ? template.content : x``;
|
|
1778
2827
|
}
|
|
1779
2828
|
applyStyles() {
|
|
1780
2829
|
const sheet = new CSSStyleSheet();
|
|
@@ -1782,21 +2831,21 @@ var TestContainer = class extends LitElement14 {
|
|
|
1782
2831
|
this.shadowRoot.adoptedStyleSheets = [sheet];
|
|
1783
2832
|
}
|
|
1784
2833
|
render() {
|
|
1785
|
-
return
|
|
2834
|
+
return x`
|
|
1786
2835
|
${this.templateContent}
|
|
1787
2836
|
<slot></slot>
|
|
1788
|
-
${
|
|
2837
|
+
${m(this.testDoc, x`<span>Loading...</span>`)}
|
|
1789
2838
|
`;
|
|
1790
2839
|
}
|
|
1791
2840
|
};
|
|
1792
2841
|
__decorateClass([
|
|
1793
|
-
|
|
2842
|
+
n({ type: String, attribute: "test-url" })
|
|
1794
2843
|
], TestContainer.prototype, "testURL", 2);
|
|
1795
2844
|
__decorateClass([
|
|
1796
|
-
|
|
2845
|
+
r()
|
|
1797
2846
|
], TestContainer.prototype, "testDoc", 2);
|
|
1798
2847
|
__decorateClass([
|
|
1799
|
-
|
|
2848
|
+
r()
|
|
1800
2849
|
], TestContainer.prototype, "testXML", 2);
|
|
1801
2850
|
__decorateClass([
|
|
1802
2851
|
watch("testURL", { waitUntilFirstUpdate: true })
|
|
@@ -1805,20 +2854,17 @@ __decorateClass([
|
|
|
1805
2854
|
watch("testXML", { waitUntilFirstUpdate: true })
|
|
1806
2855
|
], TestContainer.prototype, "handleTestXMLChange", 1);
|
|
1807
2856
|
TestContainer = __decorateClass([
|
|
1808
|
-
|
|
2857
|
+
t("test-container")
|
|
1809
2858
|
], TestContainer);
|
|
1810
2859
|
|
|
1811
|
-
//
|
|
1812
|
-
|
|
1813
|
-
import { consume as consume9 } from "@lit/context";
|
|
1814
|
-
import { customElement as customElement14 } from "lit/decorators.js";
|
|
1815
|
-
var TestPrintVariables = class extends LitElement15 {
|
|
2860
|
+
// ../qti-test/src/components/test-print-item-variables/test-print-item-variables.ts
|
|
2861
|
+
var TestPrintVariables = class extends i2 {
|
|
1816
2862
|
render() {
|
|
1817
2863
|
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
1818
|
-
if (!activeItem || !activeItem.variables) return
|
|
2864
|
+
if (!activeItem || !activeItem.variables) return x``;
|
|
1819
2865
|
const responseVariables = activeItem.variables.filter((v) => v.type === "response");
|
|
1820
2866
|
const outcomeVariables = activeItem.variables.filter((v) => v.type === "outcome");
|
|
1821
|
-
const renderTable = (variables, title) =>
|
|
2867
|
+
const renderTable = (variables, title) => x`
|
|
1822
2868
|
<h3>${title}</h3>
|
|
1823
2869
|
<table>
|
|
1824
2870
|
<thead>
|
|
@@ -1833,9 +2879,9 @@ var TestPrintVariables = class extends LitElement15 {
|
|
|
1833
2879
|
<tbody>
|
|
1834
2880
|
${variables.map((v) => {
|
|
1835
2881
|
const correctResponse = v.correctResponse ? Array.isArray(v.correctResponse) ? v.correctResponse.join(", ") : v.correctResponse : "";
|
|
1836
|
-
const mapEntries = v.mapping?.mapEntries?.map((
|
|
1837
|
-
const areaMapEntries = v.areaMapping?.areaMapEntries?.map((
|
|
1838
|
-
return
|
|
2882
|
+
const mapEntries = v.mapping?.mapEntries?.map((m2) => `${m2.mapKey}=${m2.mappedValue}pt`).join(", ") || "";
|
|
2883
|
+
const areaMapEntries = v.areaMapping?.areaMapEntries?.map((m2) => `${m2.shape}(${m2.coords})=${m2.mappedValue}pt`).join(", ") || "";
|
|
2884
|
+
return x`
|
|
1839
2885
|
<tr>
|
|
1840
2886
|
<td>${v.identifier}</td>
|
|
1841
2887
|
<td>${Array.isArray(v.value) ? v.value.join(", ") : v.value}</td>
|
|
@@ -1848,12 +2894,12 @@ var TestPrintVariables = class extends LitElement15 {
|
|
|
1848
2894
|
</tbody>
|
|
1849
2895
|
</table>
|
|
1850
2896
|
`;
|
|
1851
|
-
return
|
|
2897
|
+
return x`
|
|
1852
2898
|
${renderTable(responseVariables, "Response Variables")} ${renderTable(outcomeVariables, "Outcome Variables")}
|
|
1853
2899
|
`;
|
|
1854
2900
|
}
|
|
1855
2901
|
};
|
|
1856
|
-
TestPrintVariables.styles =
|
|
2902
|
+
TestPrintVariables.styles = i`
|
|
1857
2903
|
table {
|
|
1858
2904
|
width: 100%;
|
|
1859
2905
|
border-collapse: collapse;
|
|
@@ -1876,18 +2922,14 @@ TestPrintVariables.styles = css8`
|
|
|
1876
2922
|
}
|
|
1877
2923
|
`;
|
|
1878
2924
|
__decorateClass([
|
|
1879
|
-
|
|
2925
|
+
c({ context: computedContext, subscribe: true })
|
|
1880
2926
|
], TestPrintVariables.prototype, "computedContext", 2);
|
|
1881
2927
|
TestPrintVariables = __decorateClass([
|
|
1882
|
-
|
|
2928
|
+
t("test-print-item-variables")
|
|
1883
2929
|
], TestPrintVariables);
|
|
1884
2930
|
|
|
1885
|
-
//
|
|
1886
|
-
|
|
1887
|
-
import { customElement as customElement15 } from "lit/decorators.js";
|
|
1888
|
-
import { prepareTemplate as prepareTemplate2 } from "@heximal/templates";
|
|
1889
|
-
import { consume as consume10 } from "@lit/context";
|
|
1890
|
-
var TestSectionButtonsStamp = class extends LitElement16 {
|
|
2931
|
+
// ../qti-test/src/components/test-section-buttons-stamp/test-section-buttons-stamp.ts
|
|
2932
|
+
var TestSectionButtonsStamp = class extends i2 {
|
|
1891
2933
|
createRenderRoot() {
|
|
1892
2934
|
return this;
|
|
1893
2935
|
}
|
|
@@ -1899,25 +2941,23 @@ var TestSectionButtonsStamp = class extends LitElement16 {
|
|
|
1899
2941
|
connectedCallback() {
|
|
1900
2942
|
super.connectedCallback();
|
|
1901
2943
|
const templateElement = this.querySelector("template");
|
|
1902
|
-
this.myTemplate =
|
|
2944
|
+
this.myTemplate = prepareTemplate(templateElement);
|
|
1903
2945
|
}
|
|
1904
2946
|
render() {
|
|
1905
|
-
if (!this.computedContext) return
|
|
2947
|
+
if (!this.computedContext) return x``;
|
|
1906
2948
|
const sections = this.computedContext.testParts.flatMap((testPart) => testPart.sections);
|
|
1907
|
-
return
|
|
2949
|
+
return x` ${sections.map((item) => this.myTemplate({ item }))} `;
|
|
1908
2950
|
}
|
|
1909
2951
|
};
|
|
1910
2952
|
__decorateClass([
|
|
1911
|
-
|
|
2953
|
+
c({ context: computedContext, subscribe: true })
|
|
1912
2954
|
], TestSectionButtonsStamp.prototype, "computedContext", 2);
|
|
1913
2955
|
TestSectionButtonsStamp = __decorateClass([
|
|
1914
|
-
|
|
2956
|
+
t("test-section-buttons-stamp")
|
|
1915
2957
|
], TestSectionButtonsStamp);
|
|
1916
2958
|
|
|
1917
|
-
//
|
|
1918
|
-
|
|
1919
|
-
import { customElement as customElement16, property as property14 } from "lit/decorators.js";
|
|
1920
|
-
var TestSectionLink = class extends LitElement17 {
|
|
2959
|
+
// ../qti-test/src/components/test-section-link/test-section-link.ts
|
|
2960
|
+
var TestSectionLink = class extends i2 {
|
|
1921
2961
|
constructor() {
|
|
1922
2962
|
super();
|
|
1923
2963
|
this.sectionId = null;
|
|
@@ -1936,10 +2976,10 @@ var TestSectionLink = class extends LitElement17 {
|
|
|
1936
2976
|
);
|
|
1937
2977
|
}
|
|
1938
2978
|
render() {
|
|
1939
|
-
return
|
|
2979
|
+
return x` <slot></slot> `;
|
|
1940
2980
|
}
|
|
1941
2981
|
};
|
|
1942
|
-
TestSectionLink.styles =
|
|
2982
|
+
TestSectionLink.styles = i`
|
|
1943
2983
|
:host {
|
|
1944
2984
|
${btn};
|
|
1945
2985
|
}
|
|
@@ -1948,35 +2988,28 @@ TestSectionLink.styles = css9`
|
|
|
1948
2988
|
}
|
|
1949
2989
|
`;
|
|
1950
2990
|
__decorateClass([
|
|
1951
|
-
|
|
2991
|
+
n({ type: String, attribute: "section-id" })
|
|
1952
2992
|
], TestSectionLink.prototype, "sectionId", 2);
|
|
1953
2993
|
TestSectionLink = __decorateClass([
|
|
1954
|
-
|
|
2994
|
+
t("test-section-link")
|
|
1955
2995
|
], TestSectionLink);
|
|
1956
2996
|
|
|
1957
|
-
//
|
|
1958
|
-
|
|
1959
|
-
import { consume as consume11 } from "@lit/context";
|
|
1960
|
-
import { customElement as customElement17, state as state4 } from "lit/decorators.js";
|
|
1961
|
-
var TestPrintContext = class extends LitElement18 {
|
|
2997
|
+
// ../qti-test/src/components/test-print-context/test-print-context.ts
|
|
2998
|
+
var TestPrintContext = class extends i2 {
|
|
1962
2999
|
render() {
|
|
1963
|
-
return
|
|
3000
|
+
return x` <small><pre>${JSON.stringify(this.computedContext, null, 2)}</pre></small> `;
|
|
1964
3001
|
}
|
|
1965
3002
|
};
|
|
1966
3003
|
__decorateClass([
|
|
1967
|
-
|
|
1968
|
-
|
|
3004
|
+
r(),
|
|
3005
|
+
c({ context: computedContext, subscribe: true })
|
|
1969
3006
|
], TestPrintContext.prototype, "computedContext", 2);
|
|
1970
3007
|
TestPrintContext = __decorateClass([
|
|
1971
|
-
|
|
3008
|
+
t("test-print-context")
|
|
1972
3009
|
], TestPrintContext);
|
|
1973
3010
|
|
|
1974
|
-
//
|
|
1975
|
-
|
|
1976
|
-
import { customElement as customElement18, property as property15, state as state5 } from "lit/decorators.js";
|
|
1977
|
-
import { prepareTemplate as prepareTemplate3 } from "@heximal/templates";
|
|
1978
|
-
import { consume as consume12 } from "@lit/context";
|
|
1979
|
-
var TestStamp = class extends LitElement19 {
|
|
3011
|
+
// ../qti-test/src/components/test-stamp/test-stamp.ts
|
|
3012
|
+
var TestStamp = class extends i2 {
|
|
1980
3013
|
constructor() {
|
|
1981
3014
|
super(...arguments);
|
|
1982
3015
|
this.debug = false;
|
|
@@ -2003,7 +3036,7 @@ var TestStamp = class extends LitElement19 {
|
|
|
2003
3036
|
this.myTemplate = null;
|
|
2004
3037
|
return;
|
|
2005
3038
|
}
|
|
2006
|
-
this.myTemplate =
|
|
3039
|
+
this.myTemplate = prepareTemplate(templateElement);
|
|
2007
3040
|
}
|
|
2008
3041
|
willUpdate(_changedProperties) {
|
|
2009
3042
|
if (!this.computedContext) {
|
|
@@ -2041,37 +3074,33 @@ var TestStamp = class extends LitElement19 {
|
|
|
2041
3074
|
);
|
|
2042
3075
|
}
|
|
2043
3076
|
render() {
|
|
2044
|
-
return
|
|
2045
|
-
${this.myTemplate ? this.myTemplate(this.stampContext) :
|
|
3077
|
+
return x` ${this.debug ? x`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : E}
|
|
3078
|
+
${this.myTemplate ? this.myTemplate(this.stampContext) : E}`;
|
|
2046
3079
|
}
|
|
2047
3080
|
};
|
|
2048
3081
|
__decorateClass([
|
|
2049
|
-
|
|
3082
|
+
n({ type: Boolean, reflect: true })
|
|
2050
3083
|
], TestStamp.prototype, "debug", 2);
|
|
2051
3084
|
__decorateClass([
|
|
2052
|
-
|
|
2053
|
-
|
|
3085
|
+
r(),
|
|
3086
|
+
c({ context: computedContext, subscribe: true })
|
|
2054
3087
|
], TestStamp.prototype, "computedContext", 2);
|
|
2055
3088
|
__decorateClass([
|
|
2056
|
-
|
|
3089
|
+
r()
|
|
2057
3090
|
], TestStamp.prototype, "stampContext", 2);
|
|
2058
3091
|
TestStamp = __decorateClass([
|
|
2059
|
-
|
|
3092
|
+
t("test-stamp")
|
|
2060
3093
|
], TestStamp);
|
|
2061
3094
|
|
|
2062
|
-
//
|
|
2063
|
-
|
|
2064
|
-
import { consume as consume13 } from "@lit/context";
|
|
2065
|
-
import { customElement as customElement19, property as property16 } from "lit/decorators.js";
|
|
2066
|
-
import { prepareTemplate as prepareTemplate4 } from "@heximal/templates";
|
|
2067
|
-
var TestScoringButtons = class extends LitElement20 {
|
|
3095
|
+
// ../qti-test/src/components/test-scoring-buttons/test-scoring-buttons.ts
|
|
3096
|
+
var TestScoringButtons = class extends i2 {
|
|
2068
3097
|
constructor() {
|
|
2069
3098
|
super();
|
|
2070
3099
|
this.view = "";
|
|
2071
3100
|
this.disabled = false;
|
|
2072
3101
|
this.myTemplate = null;
|
|
2073
|
-
this.addEventListener("click", (
|
|
2074
|
-
const target =
|
|
3102
|
+
this.addEventListener("click", (e2) => {
|
|
3103
|
+
const target = e2.target;
|
|
2075
3104
|
const value = parseFloat(target.value);
|
|
2076
3105
|
if (target.tagName === "INPUT") {
|
|
2077
3106
|
this._changeOutcomeScore(value);
|
|
@@ -2088,7 +3117,7 @@ var TestScoringButtons = class extends LitElement20 {
|
|
|
2088
3117
|
this.myTemplate = null;
|
|
2089
3118
|
return;
|
|
2090
3119
|
}
|
|
2091
|
-
this.myTemplate =
|
|
3120
|
+
this.myTemplate = prepareTemplate(templateElement);
|
|
2092
3121
|
}
|
|
2093
3122
|
_changeOutcomeScore(value) {
|
|
2094
3123
|
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
@@ -2107,35 +3136,31 @@ var TestScoringButtons = class extends LitElement20 {
|
|
|
2107
3136
|
}
|
|
2108
3137
|
render() {
|
|
2109
3138
|
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
2110
|
-
if (!activeItem || !activeItem.variables) return
|
|
3139
|
+
if (!activeItem || !activeItem.variables) return x``;
|
|
2111
3140
|
const maxScore = activeItem.variables.find((vr) => vr.identifier == "MAXSCORE")?.value;
|
|
2112
3141
|
const scoreOutcome = activeItem.variables.find((vr) => vr.identifier == "SCORE");
|
|
2113
3142
|
const score = scoreOutcome?.value;
|
|
2114
3143
|
const disabled = !(scoreOutcome?.externalScored === "human");
|
|
2115
|
-
if (!maxScore || !scoreOutcome) return
|
|
3144
|
+
if (!maxScore || !scoreOutcome) return E;
|
|
2116
3145
|
const scores = [...Array(Number(maxScore) + 1).keys()];
|
|
2117
|
-
return
|
|
3146
|
+
return x`${this.myTemplate ? this.myTemplate({ scores, score, disabled }) : E}`;
|
|
2118
3147
|
}
|
|
2119
3148
|
};
|
|
2120
3149
|
__decorateClass([
|
|
2121
|
-
|
|
3150
|
+
n({ type: String, attribute: "view" })
|
|
2122
3151
|
], TestScoringButtons.prototype, "view", 2);
|
|
2123
3152
|
__decorateClass([
|
|
2124
|
-
|
|
3153
|
+
n({ type: Boolean })
|
|
2125
3154
|
], TestScoringButtons.prototype, "disabled", 2);
|
|
2126
3155
|
__decorateClass([
|
|
2127
|
-
|
|
3156
|
+
c({ context: computedContext, subscribe: true })
|
|
2128
3157
|
], TestScoringButtons.prototype, "computedContext", 2);
|
|
2129
3158
|
TestScoringButtons = __decorateClass([
|
|
2130
|
-
|
|
3159
|
+
t("test-scoring-buttons")
|
|
2131
3160
|
], TestScoringButtons);
|
|
2132
3161
|
|
|
2133
|
-
//
|
|
2134
|
-
|
|
2135
|
-
import { html as html21, LitElement as LitElement21, nothing as nothing3 } from "lit";
|
|
2136
|
-
import { customElement as customElement20 } from "lit/decorators.js";
|
|
2137
|
-
import { prepareTemplate as prepareTemplate5 } from "@heximal/templates";
|
|
2138
|
-
var TestViewToggle = class extends LitElement21 {
|
|
3162
|
+
// ../qti-test/src/components/test-view-toggle/test-view-toggle.ts
|
|
3163
|
+
var TestViewToggle = class extends i2 {
|
|
2139
3164
|
createRenderRoot() {
|
|
2140
3165
|
return this;
|
|
2141
3166
|
}
|
|
@@ -2146,7 +3171,7 @@ var TestViewToggle = class extends LitElement21 {
|
|
|
2146
3171
|
this.myTemplate = null;
|
|
2147
3172
|
return;
|
|
2148
3173
|
}
|
|
2149
|
-
this.myTemplate =
|
|
3174
|
+
this.myTemplate = prepareTemplate(templateElement);
|
|
2150
3175
|
}
|
|
2151
3176
|
_switchView(view) {
|
|
2152
3177
|
this.dispatchEvent(
|
|
@@ -2167,31 +3192,28 @@ var TestViewToggle = class extends LitElement21 {
|
|
|
2167
3192
|
});
|
|
2168
3193
|
}
|
|
2169
3194
|
render() {
|
|
2170
|
-
return
|
|
3195
|
+
return x`${this.myTemplate ? this.myTemplate({
|
|
2171
3196
|
view: this.sessionContext?.view
|
|
2172
|
-
}) :
|
|
3197
|
+
}) : E}`;
|
|
2173
3198
|
}
|
|
2174
3199
|
};
|
|
2175
3200
|
__decorateClass([
|
|
2176
|
-
|
|
3201
|
+
c({ context: sessionContext, subscribe: true })
|
|
2177
3202
|
], TestViewToggle.prototype, "sessionContext", 2);
|
|
2178
3203
|
TestViewToggle = __decorateClass([
|
|
2179
|
-
|
|
3204
|
+
t("test-view-toggle")
|
|
2180
3205
|
], TestViewToggle);
|
|
2181
3206
|
|
|
2182
|
-
//
|
|
2183
|
-
|
|
2184
|
-
import { html as html22, LitElement as LitElement22 } from "lit";
|
|
2185
|
-
import { customElement as customElement21, property as property17 } from "lit/decorators.js";
|
|
2186
|
-
var TestScoringFeedback = class extends LitElement22 {
|
|
3207
|
+
// ../qti-test/src/components/test-scoring-feedback/test-scoring-feedback.ts
|
|
3208
|
+
var TestScoringFeedback = class extends i2 {
|
|
2187
3209
|
constructor() {
|
|
2188
3210
|
super(...arguments);
|
|
2189
3211
|
this.view = null;
|
|
2190
3212
|
}
|
|
2191
3213
|
render() {
|
|
2192
3214
|
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
2193
|
-
if (!activeItem || !activeItem.variables) return
|
|
2194
|
-
if (activeItem["category"] === "dep-informational") return
|
|
3215
|
+
if (!activeItem || !activeItem.variables) return x``;
|
|
3216
|
+
if (activeItem["category"] === "dep-informational") return x`<div>${this.dataset.informational}</div>`;
|
|
2195
3217
|
const completionStatus = activeItem?.variables.find((v) => v.identifier === "completionStatus")?.value;
|
|
2196
3218
|
const scoreOutcome = activeItem?.variables.find((vr) => vr.identifier == "SCORE");
|
|
2197
3219
|
const score = parseFloat(scoreOutcome?.value);
|
|
@@ -2211,23 +3233,21 @@ var TestScoringFeedback = class extends LitElement22 {
|
|
|
2211
3233
|
}
|
|
2212
3234
|
return this.dataset.inProgress;
|
|
2213
3235
|
};
|
|
2214
|
-
return
|
|
3236
|
+
return x`<div>${feedbackText()}</div>`;
|
|
2215
3237
|
}
|
|
2216
3238
|
};
|
|
2217
3239
|
__decorateClass([
|
|
2218
|
-
|
|
3240
|
+
c({ context: computedContext, subscribe: true })
|
|
2219
3241
|
], TestScoringFeedback.prototype, "computedContext", 2);
|
|
2220
3242
|
__decorateClass([
|
|
2221
|
-
|
|
3243
|
+
n({ type: String, attribute: "view" })
|
|
2222
3244
|
], TestScoringFeedback.prototype, "view", 2);
|
|
2223
3245
|
TestScoringFeedback = __decorateClass([
|
|
2224
|
-
|
|
3246
|
+
t("test-scoring-feedback")
|
|
2225
3247
|
], TestScoringFeedback);
|
|
2226
3248
|
|
|
2227
|
-
//
|
|
2228
|
-
|
|
2229
|
-
import { customElement as customElement22 } from "lit/decorators.js";
|
|
2230
|
-
var TestCheckItem = class extends LitElement23 {
|
|
3249
|
+
// ../qti-test/src/components/test-check-item/test-check-item.ts
|
|
3250
|
+
var TestCheckItem = class extends i2 {
|
|
2231
3251
|
constructor() {
|
|
2232
3252
|
super();
|
|
2233
3253
|
this.addEventListener("click", () => {
|
|
@@ -2247,10 +3267,10 @@ var TestCheckItem = class extends LitElement23 {
|
|
|
2247
3267
|
});
|
|
2248
3268
|
}
|
|
2249
3269
|
render() {
|
|
2250
|
-
return
|
|
3270
|
+
return x` <slot></slot> `;
|
|
2251
3271
|
}
|
|
2252
3272
|
};
|
|
2253
|
-
TestCheckItem.styles =
|
|
3273
|
+
TestCheckItem.styles = i`
|
|
2254
3274
|
:host {
|
|
2255
3275
|
${btn};
|
|
2256
3276
|
}
|
|
@@ -2259,7 +3279,7 @@ TestCheckItem.styles = css10`
|
|
|
2259
3279
|
}
|
|
2260
3280
|
`;
|
|
2261
3281
|
TestCheckItem = __decorateClass([
|
|
2262
|
-
|
|
3282
|
+
t("test-check-item")
|
|
2263
3283
|
], TestCheckItem);
|
|
2264
3284
|
|
|
2265
3285
|
export {
|
|
@@ -2288,4 +3308,23 @@ export {
|
|
|
2288
3308
|
TestScoringFeedback,
|
|
2289
3309
|
TestCheckItem
|
|
2290
3310
|
};
|
|
2291
|
-
|
|
3311
|
+
/*! Bundled license information:
|
|
3312
|
+
|
|
3313
|
+
@heximal/expressions/lib/constants.js:
|
|
3314
|
+
@heximal/expressions/lib/tokenizer.js:
|
|
3315
|
+
@heximal/expressions/lib/parser.js:
|
|
3316
|
+
@heximal/expressions/lib/ast_factory.js:
|
|
3317
|
+
@heximal/expressions/lib/eval.js:
|
|
3318
|
+
(*
|
|
3319
|
+
* @license
|
|
3320
|
+
* Portions Copyright (c) 2013, the Dart project authors.
|
|
3321
|
+
*)
|
|
3322
|
+
|
|
3323
|
+
lit-html/node/private-ssr-support.js:
|
|
3324
|
+
(**
|
|
3325
|
+
* @license
|
|
3326
|
+
* Copyright 2019 Google LLC
|
|
3327
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3328
|
+
*)
|
|
3329
|
+
*/
|
|
3330
|
+
//# sourceMappingURL=chunk-352OTVTY.js.map
|