@citolab/qti-components 7.14.2 → 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 +4070 -4048
- package/custom-elements.json +10320 -25886
- package/dist/base.d.ts +8 -0
- package/dist/base.js +50 -0
- package/dist/{chunks/chunk-7567ZPN6.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-Z2FFXTKX.js → chunk-352OTVTY.js} +1483 -445
- package/dist/chunk-352OTVTY.js.map +1 -0
- package/dist/{chunks/chunk-2X2C5WI5.js → chunk-C2HQFI2C.js} +939 -3842
- 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-PT5ASWGQ.js → chunk-W4SQRNWO.js} +105 -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 +118 -284
- package/dist/index.js.map +1 -1
- package/dist/interactions.d.ts +1 -0
- package/dist/interactions.js +72 -0
- package/dist/item.css +8 -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 +1540 -2452
- 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 +71 -167
- package/LICENSE.md +0 -674
- package/dist/chunks/chunk-2X2C5WI5.js.map +0 -1
- package/dist/chunks/chunk-4OGJBG35.js +0 -8
- package/dist/chunks/chunk-4OGJBG35.js.map +0 -1
- package/dist/chunks/chunk-7567ZPN6.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-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-DVQQ7I6Y.js +0 -8
- package/dist/chunks/chunk-DVQQ7I6Y.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-PT5ASWGQ.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-XBPO6E25.js.map +0 -1
- package/dist/chunks/chunk-YD7FVKDP.js +0 -236
- package/dist/chunks/chunk-YD7FVKDP.js.map +0 -1
- package/dist/chunks/chunk-Z2FFXTKX.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 -1522
- package/dist/qti-components/index.js +0 -214
- 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-PKbhO-3w.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-Db7oNIWY.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
|
-
import {
|
|
2
|
-
INITIAL_SESSION_CONTEXT,
|
|
3
|
-
sessionContext
|
|
4
|
-
} from "./chunk-C5RLRG3L.js";
|
|
5
|
-
import {
|
|
6
|
-
item_default
|
|
7
|
-
} from "./chunk-PT5ASWGQ.js";
|
|
8
1
|
import {
|
|
9
2
|
QtiModalFeedback
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import {
|
|
12
|
-
INITIAL_TEST_CONTEXT,
|
|
13
|
-
testContext
|
|
14
|
-
} from "./chunk-CJADUWEC.js";
|
|
3
|
+
} from "./chunk-O4XIWHTF.js";
|
|
15
4
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
item_default,
|
|
6
|
+
m
|
|
7
|
+
} from "./chunk-W4SQRNWO.js";
|
|
18
8
|
import {
|
|
19
9
|
watch
|
|
20
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2ZEJ3RR5.js";
|
|
21
11
|
import {
|
|
22
12
|
qtiTransformItem,
|
|
23
13
|
qtiTransformTest
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import {
|
|
26
|
-
computedContext
|
|
27
|
-
} from "./chunk-DVQQ7I6Y.js";
|
|
14
|
+
} from "./chunk-INKI27D5.js";
|
|
28
15
|
import {
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
E,
|
|
17
|
+
INITIAL_SESSION_CONTEXT,
|
|
18
|
+
INITIAL_TEST_CONTEXT,
|
|
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,
|
|
@@ -248,7 +247,6 @@ var TestNavigationMixin = (superClass) => {
|
|
|
248
247
|
const allStimulusLoaded = this._loadingState.loadedStimulus >= this._loadingState.expectedStimulus;
|
|
249
248
|
if (allItemsConnected && allStimulusLoaded && !this._loadingState.isComplete) {
|
|
250
249
|
this._loadingState.isComplete = true;
|
|
251
|
-
console.info("Loading complete:", this._loadingState);
|
|
252
250
|
}
|
|
253
251
|
}
|
|
254
252
|
/**
|
|
@@ -465,39 +463,39 @@ var TestNavigationMixin = (superClass) => {
|
|
|
465
463
|
}
|
|
466
464
|
}
|
|
467
465
|
__decorateClass([
|
|
468
|
-
|
|
466
|
+
n({ type: String })
|
|
469
467
|
], TestNavigationClass.prototype, "navigate", 2);
|
|
470
468
|
__decorateClass([
|
|
471
|
-
|
|
469
|
+
n({ type: Boolean, attribute: "cache-transform" })
|
|
472
470
|
], TestNavigationClass.prototype, "cacheTransform", 2);
|
|
473
471
|
__decorateClass([
|
|
474
|
-
|
|
472
|
+
n({ type: Number })
|
|
475
473
|
], TestNavigationClass.prototype, "requestTimeout", 2);
|
|
476
474
|
__decorateClass([
|
|
477
|
-
|
|
475
|
+
n({ attribute: false })
|
|
478
476
|
], TestNavigationClass.prototype, "postLoadTransformCallback", 2);
|
|
479
477
|
__decorateClass([
|
|
480
|
-
|
|
478
|
+
n({ attribute: false })
|
|
481
479
|
], TestNavigationClass.prototype, "postLoadTestTransformCallback", 2);
|
|
482
480
|
return TestNavigationClass;
|
|
483
481
|
};
|
|
484
482
|
|
|
485
|
-
//
|
|
483
|
+
// ../qti-test/src/mixins/test-view.mixin.ts
|
|
486
484
|
var TestViewMixin = (superClass) => {
|
|
487
485
|
class TestViewClass extends superClass {
|
|
488
486
|
constructor(...args) {
|
|
489
487
|
super(...args);
|
|
490
488
|
this.sessionContext = { ...this.sessionContext, view: "candidate" };
|
|
491
|
-
this.addEventListener("on-test-switch-view", (
|
|
492
|
-
this.sessionContext = { ...this.sessionContext, view:
|
|
489
|
+
this.addEventListener("on-test-switch-view", (e2) => {
|
|
490
|
+
this.sessionContext = { ...this.sessionContext, view: e2.detail };
|
|
493
491
|
this._updateElementView();
|
|
494
492
|
});
|
|
495
493
|
this.addEventListener("qti-assessment-test-connected", () => {
|
|
496
494
|
this._updateElementView();
|
|
497
495
|
});
|
|
498
|
-
this.addEventListener("qti-assessment-item-connected", (
|
|
496
|
+
this.addEventListener("qti-assessment-item-connected", (e2) => {
|
|
499
497
|
this._updateElementView();
|
|
500
|
-
this._setCorrectResponseVisibility(
|
|
498
|
+
this._setCorrectResponseVisibility(e2.detail);
|
|
501
499
|
});
|
|
502
500
|
}
|
|
503
501
|
willUpdate(changedProperties) {
|
|
@@ -530,146 +528,151 @@ var TestViewMixin = (superClass) => {
|
|
|
530
528
|
return TestViewClass;
|
|
531
529
|
};
|
|
532
530
|
|
|
533
|
-
//
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
constructor() {
|
|
539
|
-
super();
|
|
540
|
-
this.testContext = INITIAL_TEST_CONTEXT;
|
|
541
|
-
this.sessionContext = INITIAL_SESSION_CONTEXT;
|
|
542
|
-
/**
|
|
543
|
-
* Updates the variables of an assessment item in the test context.
|
|
544
|
-
* - Matches the assessment item with the corresponding test context item.
|
|
545
|
-
* - If the item is not found, logs a warning.
|
|
546
|
-
* - Updates variables in the test context if exactly one variable exists.
|
|
547
|
-
* - Otherwise, syncs the assessment item's variables with the test context.
|
|
548
|
-
*
|
|
549
|
-
* @param assessmentItem - The assessment item to update.
|
|
550
|
-
*/
|
|
551
|
-
this._updateItemInTestContext = (assessmentItem) => {
|
|
552
|
-
const context = assessmentItem._context;
|
|
553
|
-
const identifier = context.identifier;
|
|
554
|
-
const fullVariables = context.variables;
|
|
555
|
-
const itemContext = this.testContext.items.find((i) => i?.identifier === identifier);
|
|
556
|
-
if (!itemContext) {
|
|
557
|
-
console.warn(`Item IDs between assessment.xml and item.xml should match: ${identifier} is not found!`);
|
|
558
|
-
return;
|
|
559
|
-
}
|
|
560
|
-
if (itemContext.variables?.length === 1) {
|
|
561
|
-
this._updateItemVariablesInTestContext(identifier, fullVariables);
|
|
562
|
-
} else {
|
|
563
|
-
const newVariables = [...assessmentItem.variables];
|
|
564
|
-
for (const variable of itemContext.variables) {
|
|
565
|
-
const currentVariable = newVariables.find((v) => v.identifier === variable.identifier);
|
|
566
|
-
if (currentVariable) {
|
|
567
|
-
currentVariable.value = variable.value;
|
|
568
|
-
} else {
|
|
569
|
-
newVariables.push(variable);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
assessmentItem.variables = newVariables;
|
|
573
|
-
}
|
|
574
|
-
};
|
|
575
|
-
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);
|
|
576
536
|
this.testContext = INITIAL_TEST_CONTEXT;
|
|
577
537
|
this.sessionContext = INITIAL_SESSION_CONTEXT;
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
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);
|
|
590
566
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
const
|
|
599
|
-
if (
|
|
600
|
-
|
|
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
|
+
});
|
|
601
580
|
}
|
|
602
|
-
this.
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
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);
|
|
614
620
|
});
|
|
615
621
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
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
|
+
);
|
|
621
643
|
}
|
|
622
644
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
variables: variables.map((variable) => {
|
|
635
|
-
const matchingVariable = itemContext.variables.find((v) => v.identifier === variable.identifier);
|
|
636
|
-
return matchingVariable ? { ...matchingVariable, ...variable } : variable;
|
|
637
|
-
})
|
|
638
|
-
};
|
|
639
|
-
})
|
|
640
|
-
};
|
|
641
|
-
this.dispatchEvent(
|
|
642
|
-
new CustomEvent("qti-test-context-updated", { detail: this.testContext, bubbles: false, composed: false })
|
|
643
|
-
);
|
|
644
|
-
}
|
|
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) {
|
|
645
656
|
};
|
|
646
|
-
__decorateClass([
|
|
647
|
-
property2({ attribute: false, type: Object }),
|
|
648
|
-
provide({ context: testContext })
|
|
649
|
-
], TestBase.prototype, "testContext", 2);
|
|
650
|
-
__decorateClass([
|
|
651
|
-
property2({ attribute: false, type: Object }),
|
|
652
|
-
provide({ context: sessionContext })
|
|
653
|
-
], TestBase.prototype, "sessionContext", 2);
|
|
654
657
|
|
|
655
|
-
//
|
|
658
|
+
// ../qti-test/src/mixins/test-processing.mixin.ts
|
|
656
659
|
var TestProcessingMixin = (superClass) => {
|
|
657
660
|
class TestProcessingElement extends superClass {
|
|
658
661
|
constructor(...args) {
|
|
659
662
|
super(...args);
|
|
660
|
-
this.addEventListener("qti-register-variable", (
|
|
663
|
+
this.addEventListener("qti-register-variable", (e2) => {
|
|
661
664
|
this.testContext = {
|
|
662
665
|
...this.testContext,
|
|
663
|
-
testOutcomeVariables: [...this.testContext.testOutcomeVariables || [],
|
|
666
|
+
testOutcomeVariables: [...this.testContext.testOutcomeVariables || [], e2.detail.variable]
|
|
664
667
|
};
|
|
665
|
-
|
|
668
|
+
e2.stopPropagation();
|
|
666
669
|
});
|
|
667
670
|
this.addEventListener(
|
|
668
671
|
"qti-set-outcome-value",
|
|
669
|
-
(
|
|
670
|
-
const { outcomeIdentifier, value } =
|
|
672
|
+
(e2) => {
|
|
673
|
+
const { outcomeIdentifier, value } = e2.detail;
|
|
671
674
|
this.updateOutcomeVariable(outcomeIdentifier, value);
|
|
672
|
-
|
|
675
|
+
e2.stopPropagation();
|
|
673
676
|
}
|
|
674
677
|
);
|
|
675
678
|
}
|
|
@@ -710,8 +713,9 @@ var TestProcessingMixin = (superClass) => {
|
|
|
710
713
|
return TestProcessingElement;
|
|
711
714
|
};
|
|
712
715
|
|
|
713
|
-
// src/
|
|
714
|
-
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
|
|
715
719
|
// export class QtiTest extends TestLoaderMixin(TestNavigationMixin(TestViewMixin(TestBase))) {
|
|
716
720
|
/**
|
|
717
721
|
* Renders the component's template.
|
|
@@ -723,16 +727,14 @@ var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixi
|
|
|
723
727
|
this.dispatchEvent(new CustomEvent("qti-test-connected", { detail: this }));
|
|
724
728
|
}
|
|
725
729
|
render() {
|
|
726
|
-
return
|
|
730
|
+
return x`<slot></slot>`;
|
|
727
731
|
}
|
|
728
732
|
};
|
|
729
733
|
QtiTest = __decorateClass([
|
|
730
|
-
|
|
734
|
+
t("qti-test")
|
|
731
735
|
], QtiTest);
|
|
732
736
|
|
|
733
|
-
//
|
|
734
|
-
import { LitElement as LitElement2 } from "lit";
|
|
735
|
-
import { property as property3 } from "lit/decorators.js";
|
|
737
|
+
// ../qti-test/src/components/qti-assessment-item-ref/qti-assessment-item-ref.ts
|
|
736
738
|
var stringToBooleanConverter = {
|
|
737
739
|
fromAttribute(value) {
|
|
738
740
|
return value === "true";
|
|
@@ -741,7 +743,7 @@ var stringToBooleanConverter = {
|
|
|
741
743
|
return value ? "true" : "false";
|
|
742
744
|
}
|
|
743
745
|
};
|
|
744
|
-
var QtiAssessmentItemRef = class extends
|
|
746
|
+
var QtiAssessmentItemRef = class extends i2 {
|
|
745
747
|
constructor() {
|
|
746
748
|
super(...arguments);
|
|
747
749
|
// @consume({ context: computedContext, subscribe: true })
|
|
@@ -771,31 +773,28 @@ var QtiAssessmentItemRef = class extends LitElement2 {
|
|
|
771
773
|
}
|
|
772
774
|
};
|
|
773
775
|
__decorateClass([
|
|
774
|
-
|
|
776
|
+
n({ type: String })
|
|
775
777
|
], QtiAssessmentItemRef.prototype, "category", 2);
|
|
776
778
|
__decorateClass([
|
|
777
|
-
|
|
779
|
+
n({ type: String })
|
|
778
780
|
], QtiAssessmentItemRef.prototype, "identifier", 2);
|
|
779
781
|
__decorateClass([
|
|
780
|
-
|
|
782
|
+
n({ type: Boolean, converter: stringToBooleanConverter })
|
|
781
783
|
], QtiAssessmentItemRef.prototype, "required", 2);
|
|
782
784
|
__decorateClass([
|
|
783
|
-
|
|
785
|
+
n({ type: Boolean, converter: stringToBooleanConverter })
|
|
784
786
|
], QtiAssessmentItemRef.prototype, "fixed", 2);
|
|
785
787
|
__decorateClass([
|
|
786
|
-
|
|
788
|
+
n({ type: String })
|
|
787
789
|
], QtiAssessmentItemRef.prototype, "href", 2);
|
|
788
790
|
__decorateClass([
|
|
789
|
-
|
|
791
|
+
n({ type: Object, attribute: false })
|
|
790
792
|
], QtiAssessmentItemRef.prototype, "xmlDoc", 2);
|
|
791
793
|
if (!customElements.get("qti-assessment-item-ref")) {
|
|
792
794
|
customElements.define("qti-assessment-item-ref", QtiAssessmentItemRef);
|
|
793
795
|
}
|
|
794
796
|
|
|
795
|
-
//
|
|
796
|
-
import { consume } from "@lit/context";
|
|
797
|
-
import { html as html2, LitElement as LitElement3 } from "lit";
|
|
798
|
-
import { property as property4 } from "lit/decorators.js";
|
|
797
|
+
// ../qti-test/src/components/qti-assessment-section/qti-assessment-section.ts
|
|
799
798
|
var stringToBooleanConverter2 = {
|
|
800
799
|
fromAttribute(value) {
|
|
801
800
|
return value === "true";
|
|
@@ -804,7 +803,7 @@ var stringToBooleanConverter2 = {
|
|
|
804
803
|
return value ? "true" : "false";
|
|
805
804
|
}
|
|
806
805
|
};
|
|
807
|
-
var QtiAssessmentSection = class extends
|
|
806
|
+
var QtiAssessmentSection = class extends i2 {
|
|
808
807
|
constructor() {
|
|
809
808
|
super(...arguments);
|
|
810
809
|
this._title = "";
|
|
@@ -829,36 +828,33 @@ var QtiAssessmentSection = class extends LitElement3 {
|
|
|
829
828
|
);
|
|
830
829
|
}
|
|
831
830
|
render() {
|
|
832
|
-
return
|
|
831
|
+
return x`<slot name="qti-rubric-block"></slot><slot></slot>`;
|
|
833
832
|
}
|
|
834
833
|
};
|
|
835
834
|
__decorateClass([
|
|
836
|
-
|
|
835
|
+
n({ type: String })
|
|
837
836
|
], QtiAssessmentSection.prototype, "identifier", 2);
|
|
838
837
|
__decorateClass([
|
|
839
|
-
|
|
838
|
+
n({ type: String })
|
|
840
839
|
], QtiAssessmentSection.prototype, "required", 2);
|
|
841
840
|
__decorateClass([
|
|
842
|
-
|
|
841
|
+
n({ type: Boolean, converter: stringToBooleanConverter2 })
|
|
843
842
|
], QtiAssessmentSection.prototype, "fixed", 2);
|
|
844
843
|
__decorateClass([
|
|
845
|
-
|
|
844
|
+
n({ type: Boolean, converter: stringToBooleanConverter2 })
|
|
846
845
|
], QtiAssessmentSection.prototype, "visible", 2);
|
|
847
846
|
__decorateClass([
|
|
848
|
-
|
|
847
|
+
n({ type: Boolean, converter: stringToBooleanConverter2, attribute: "keep-together" })
|
|
849
848
|
], QtiAssessmentSection.prototype, "keepTogether", 2);
|
|
850
849
|
__decorateClass([
|
|
851
|
-
|
|
850
|
+
c({ context: testContext, subscribe: true })
|
|
852
851
|
], QtiAssessmentSection.prototype, "_testContext", 2);
|
|
853
852
|
if (!customElements.get("qti-assessment-section")) {
|
|
854
853
|
customElements.define("qti-assessment-section", QtiAssessmentSection);
|
|
855
854
|
}
|
|
856
855
|
|
|
857
|
-
//
|
|
858
|
-
|
|
859
|
-
import { html as html3, LitElement as LitElement4 } from "lit";
|
|
860
|
-
import { customElement as customElement2, property as property5 } from "lit/decorators.js";
|
|
861
|
-
var QtiAssessmentTest = class extends LitElement4 {
|
|
856
|
+
// ../qti-test/src/components/qti-assessment-test/qti-assessment-test.ts
|
|
857
|
+
var QtiAssessmentTest = class extends i2 {
|
|
862
858
|
constructor() {
|
|
863
859
|
super(...arguments);
|
|
864
860
|
this._title = "";
|
|
@@ -883,26 +879,24 @@ var QtiAssessmentTest = class extends LitElement4 {
|
|
|
883
879
|
);
|
|
884
880
|
}
|
|
885
881
|
render() {
|
|
886
|
-
return
|
|
882
|
+
return x` <slot></slot>`;
|
|
887
883
|
}
|
|
888
884
|
};
|
|
889
885
|
__decorateClass([
|
|
890
|
-
|
|
886
|
+
n({ type: String })
|
|
891
887
|
], QtiAssessmentTest.prototype, "identifier", 2);
|
|
892
888
|
__decorateClass([
|
|
893
|
-
|
|
889
|
+
n({ type: String })
|
|
894
890
|
], QtiAssessmentTest.prototype, "title", 1);
|
|
895
891
|
__decorateClass([
|
|
896
|
-
|
|
892
|
+
c({ context: testContext, subscribe: true })
|
|
897
893
|
], QtiAssessmentTest.prototype, "_testContext", 2);
|
|
898
894
|
QtiAssessmentTest = __decorateClass([
|
|
899
|
-
|
|
895
|
+
t("qti-assessment-test")
|
|
900
896
|
], QtiAssessmentTest);
|
|
901
897
|
|
|
902
|
-
//
|
|
903
|
-
|
|
904
|
-
import { customElement as customElement3, property as property6 } from "lit/decorators.js";
|
|
905
|
-
var QtiTestPart = class extends LitElement5 {
|
|
898
|
+
// ../qti-test/src/components/qti-test-part/qti-test-part.ts
|
|
899
|
+
var QtiTestPart = class extends i2 {
|
|
906
900
|
constructor() {
|
|
907
901
|
super(...arguments);
|
|
908
902
|
this.identifier = "";
|
|
@@ -930,50 +924,45 @@ var QtiTestPart = class extends LitElement5 {
|
|
|
930
924
|
);
|
|
931
925
|
}
|
|
932
926
|
render() {
|
|
933
|
-
return
|
|
927
|
+
return x` <slot></slot>`;
|
|
934
928
|
}
|
|
935
929
|
};
|
|
936
930
|
__decorateClass([
|
|
937
|
-
|
|
931
|
+
n({ type: String })
|
|
938
932
|
], QtiTestPart.prototype, "identifier", 2);
|
|
939
933
|
__decorateClass([
|
|
940
|
-
|
|
934
|
+
n({ type: String })
|
|
941
935
|
], QtiTestPart.prototype, "class", 2);
|
|
942
936
|
__decorateClass([
|
|
943
|
-
|
|
937
|
+
n({ type: String, attribute: "navigation-mode" })
|
|
944
938
|
], QtiTestPart.prototype, "navigationMode", 2);
|
|
945
939
|
__decorateClass([
|
|
946
|
-
|
|
940
|
+
n({ type: String, attribute: "submission-mode" })
|
|
947
941
|
], QtiTestPart.prototype, "submissionMode", 2);
|
|
948
942
|
QtiTestPart = __decorateClass([
|
|
949
|
-
|
|
943
|
+
t("qti-test-part")
|
|
950
944
|
], QtiTestPart);
|
|
951
945
|
if (!customElements.get("qti-test-part")) {
|
|
952
946
|
customElements.define("qti-test-part", QtiTestPart);
|
|
953
947
|
}
|
|
954
948
|
|
|
955
|
-
//
|
|
956
|
-
import { customElement as customElement4 } from "lit/decorators.js";
|
|
957
|
-
import { css, html as html5 } from "lit";
|
|
949
|
+
// ../qti-test/src/components/qti-test-feedback/qti-test-feedback.ts
|
|
958
950
|
var QtiTestFeedback = class extends QtiModalFeedback {
|
|
959
951
|
render() {
|
|
960
|
-
return
|
|
952
|
+
return x``;
|
|
961
953
|
}
|
|
962
954
|
};
|
|
963
|
-
QtiTestFeedback.styles =
|
|
955
|
+
QtiTestFeedback.styles = i`
|
|
964
956
|
:host {
|
|
965
957
|
color: gray;
|
|
966
958
|
}
|
|
967
959
|
`;
|
|
968
960
|
QtiTestFeedback = __decorateClass([
|
|
969
|
-
|
|
961
|
+
t("qti-test-feedback")
|
|
970
962
|
], QtiTestFeedback);
|
|
971
963
|
|
|
972
|
-
//
|
|
973
|
-
|
|
974
|
-
import { html as html6, LitElement as LitElement6 } from "lit";
|
|
975
|
-
import { customElement as customElement5, property as property7, state } from "lit/decorators.js";
|
|
976
|
-
var TestNavigation = class extends LitElement6 {
|
|
964
|
+
// ../qti-test/src/components/test-navigation/test-navigation.ts
|
|
965
|
+
var TestNavigation = class extends i2 {
|
|
977
966
|
constructor() {
|
|
978
967
|
super();
|
|
979
968
|
this.identifier = void 0;
|
|
@@ -1058,7 +1047,9 @@ var TestNavigation = class extends LitElement6 {
|
|
|
1058
1047
|
}
|
|
1059
1048
|
_handleInteractionChanged(_event) {
|
|
1060
1049
|
if (this.autoScoreItems) {
|
|
1061
|
-
const assessmentItem = _event.composedPath()[0].closest(
|
|
1050
|
+
const assessmentItem = _event.composedPath()[0].closest(
|
|
1051
|
+
"qti-assessment-item"
|
|
1052
|
+
);
|
|
1062
1053
|
const scoreOutcomeIdentifier = assessmentItem.variables.find((v) => v.identifier === "SCORE");
|
|
1063
1054
|
if (scoreOutcomeIdentifier && scoreOutcomeIdentifier.externalScored === null && assessmentItem.adaptive === "false") {
|
|
1064
1055
|
const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
|
|
@@ -1067,7 +1058,7 @@ var TestNavigation = class extends LitElement6 {
|
|
|
1067
1058
|
}
|
|
1068
1059
|
}
|
|
1069
1060
|
render() {
|
|
1070
|
-
return
|
|
1061
|
+
return x`<slot></slot>`;
|
|
1071
1062
|
}
|
|
1072
1063
|
/* PK: on test connected we can build the computed context */
|
|
1073
1064
|
_handleTestConnected(event) {
|
|
@@ -1119,7 +1110,7 @@ var TestNavigation = class extends LitElement6 {
|
|
|
1119
1110
|
identifier: section.identifier,
|
|
1120
1111
|
title: section.title,
|
|
1121
1112
|
items: itemElements.map((item) => ({
|
|
1122
|
-
...this.initContext?.find((
|
|
1113
|
+
...this.initContext?.find((i4) => i4.identifier === item.identifier),
|
|
1123
1114
|
active: false,
|
|
1124
1115
|
identifier: item.identifier,
|
|
1125
1116
|
categories: item.category ? item.category?.split(" ") : [],
|
|
@@ -1190,11 +1181,11 @@ var TestNavigation = class extends LitElement6 {
|
|
|
1190
1181
|
const externalScored = scoreOutcome?.getAttribute("externalScored");
|
|
1191
1182
|
const responseDeclarations = itemElement.querySelectorAll("qti-response-declaration");
|
|
1192
1183
|
const containsCorrectResponse = Array.from(responseDeclarations).some(
|
|
1193
|
-
(
|
|
1184
|
+
(r3) => r3.querySelector("qti-correct-response")
|
|
1194
1185
|
);
|
|
1195
|
-
const containsMapping = Array.from(responseDeclarations).some((
|
|
1196
|
-
const mapping =
|
|
1197
|
-
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");
|
|
1198
1189
|
return mapping?.querySelector("qti-map-entry") || areaMapping?.querySelector("qti-area-map-entry");
|
|
1199
1190
|
});
|
|
1200
1191
|
const hasCorrectResponse = containsCorrectResponse || containsMapping;
|
|
@@ -1234,14 +1225,14 @@ var TestNavigation = class extends LitElement6 {
|
|
|
1234
1225
|
...section,
|
|
1235
1226
|
active: this._sessionContext?.navSectionId === section.identifier || false,
|
|
1236
1227
|
completed: section.items.every(
|
|
1237
|
-
(item) => this._testContext.items.find((
|
|
1228
|
+
(item) => this._testContext.items.find((i4) => i4.identifier === item.identifier)?.variables.find((v) => v.identifier === "completionStatus").value === "completed"
|
|
1238
1229
|
),
|
|
1239
1230
|
items: section.items.map((item) => {
|
|
1240
|
-
const itemContext = this._testContext?.items.find((
|
|
1231
|
+
const itemContext = this._testContext?.items.find((i4) => i4.identifier === item.identifier);
|
|
1241
1232
|
const computedItem = {
|
|
1242
1233
|
...item,
|
|
1243
1234
|
...itemContext,
|
|
1244
|
-
...this.initContext?.find((
|
|
1235
|
+
...this.initContext?.find((i4) => i4.identifier === item.identifier)
|
|
1245
1236
|
};
|
|
1246
1237
|
const rawscore = computedItem.variables?.find((vr) => vr.identifier == "SCORE")?.value;
|
|
1247
1238
|
const score = rawscore === void 0 || rawscore === null ? null : parseFloat(rawscore?.toString());
|
|
@@ -1281,46 +1272,40 @@ var TestNavigation = class extends LitElement6 {
|
|
|
1281
1272
|
}
|
|
1282
1273
|
};
|
|
1283
1274
|
__decorateClass([
|
|
1284
|
-
|
|
1275
|
+
n({ type: String })
|
|
1285
1276
|
], TestNavigation.prototype, "identifier", 2);
|
|
1286
1277
|
__decorateClass([
|
|
1287
|
-
|
|
1278
|
+
r()
|
|
1288
1279
|
], TestNavigation.prototype, "initContext", 2);
|
|
1289
1280
|
__decorateClass([
|
|
1290
|
-
|
|
1291
|
-
|
|
1281
|
+
r(),
|
|
1282
|
+
e({ context: qtiContext })
|
|
1292
1283
|
], TestNavigation.prototype, "qtiContext", 2);
|
|
1293
1284
|
__decorateClass([
|
|
1294
|
-
|
|
1295
|
-
|
|
1285
|
+
r(),
|
|
1286
|
+
e({ context: configContext })
|
|
1296
1287
|
], TestNavigation.prototype, "configContext", 2);
|
|
1297
1288
|
__decorateClass([
|
|
1298
|
-
|
|
1299
|
-
|
|
1289
|
+
r(),
|
|
1290
|
+
c({ context: testContext, subscribe: true })
|
|
1300
1291
|
], TestNavigation.prototype, "_testContext", 2);
|
|
1301
1292
|
__decorateClass([
|
|
1302
|
-
|
|
1303
|
-
|
|
1293
|
+
r(),
|
|
1294
|
+
c({ context: sessionContext, subscribe: true })
|
|
1304
1295
|
], TestNavigation.prototype, "_sessionContext", 2);
|
|
1305
1296
|
__decorateClass([
|
|
1306
|
-
|
|
1307
|
-
|
|
1297
|
+
r(),
|
|
1298
|
+
e({ context: computedContext })
|
|
1308
1299
|
], TestNavigation.prototype, "computedContext", 2);
|
|
1309
1300
|
__decorateClass([
|
|
1310
|
-
|
|
1301
|
+
n({ type: Boolean, attribute: "auto-score-items" })
|
|
1311
1302
|
], TestNavigation.prototype, "autoScoreItems", 2);
|
|
1312
1303
|
TestNavigation = __decorateClass([
|
|
1313
|
-
|
|
1304
|
+
t("test-navigation")
|
|
1314
1305
|
], TestNavigation);
|
|
1315
1306
|
|
|
1316
|
-
//
|
|
1317
|
-
|
|
1318
|
-
import { customElement as customElement6, property as property8 } from "lit/decorators.js";
|
|
1319
|
-
import { consume as consume4 } from "@lit/context";
|
|
1320
|
-
|
|
1321
|
-
// src/lib/qti-test/components/styles.ts
|
|
1322
|
-
import { css as css2 } from "lit";
|
|
1323
|
-
var form = css2`
|
|
1307
|
+
// ../qti-test/src/components/styles.ts
|
|
1308
|
+
var form = i`
|
|
1324
1309
|
display: inline-flex;
|
|
1325
1310
|
align-items: center;
|
|
1326
1311
|
cursor: pointer;
|
|
@@ -1328,29 +1313,29 @@ var form = css2`
|
|
|
1328
1313
|
border-radius: 0.25rem;
|
|
1329
1314
|
user-select: none;
|
|
1330
1315
|
`;
|
|
1331
|
-
var btn =
|
|
1316
|
+
var btn = i`
|
|
1332
1317
|
background-color: lightgray;
|
|
1333
1318
|
${form};
|
|
1334
1319
|
`;
|
|
1335
|
-
var dis =
|
|
1320
|
+
var dis = i`
|
|
1336
1321
|
cursor: not-allowed;
|
|
1337
1322
|
opacity: 0.8;
|
|
1338
1323
|
`;
|
|
1339
|
-
var ind =
|
|
1324
|
+
var ind = i`
|
|
1340
1325
|
${form};
|
|
1341
1326
|
border: 1px solid gray;
|
|
1342
1327
|
`;
|
|
1343
1328
|
|
|
1344
|
-
//
|
|
1345
|
-
var TestNext = class extends
|
|
1329
|
+
// ../qti-test/src/components/test-next/test-next.ts
|
|
1330
|
+
var TestNext = class extends i2 {
|
|
1346
1331
|
constructor() {
|
|
1347
1332
|
super();
|
|
1348
1333
|
this._internalDisabled = true;
|
|
1349
1334
|
this._internals = this.attachInternals();
|
|
1350
1335
|
this._internals.role = "button";
|
|
1351
1336
|
this._internals.ariaLabel = "Next item";
|
|
1352
|
-
this.addEventListener("click", (
|
|
1353
|
-
|
|
1337
|
+
this.addEventListener("click", (e2) => {
|
|
1338
|
+
e2.preventDefault();
|
|
1354
1339
|
if (!this._internalDisabled) this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);
|
|
1355
1340
|
});
|
|
1356
1341
|
}
|
|
@@ -1387,10 +1372,10 @@ var TestNext = class extends LitElement7 {
|
|
|
1387
1372
|
);
|
|
1388
1373
|
}
|
|
1389
1374
|
render() {
|
|
1390
|
-
return
|
|
1375
|
+
return x`<slot></slot>`;
|
|
1391
1376
|
}
|
|
1392
1377
|
};
|
|
1393
|
-
TestNext.styles =
|
|
1378
|
+
TestNext.styles = i`
|
|
1394
1379
|
:host {
|
|
1395
1380
|
${btn};
|
|
1396
1381
|
}
|
|
@@ -1399,28 +1384,25 @@ TestNext.styles = css3`
|
|
|
1399
1384
|
}
|
|
1400
1385
|
`;
|
|
1401
1386
|
__decorateClass([
|
|
1402
|
-
|
|
1387
|
+
n({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
1403
1388
|
], TestNext.prototype, "_internalDisabled", 2);
|
|
1404
1389
|
__decorateClass([
|
|
1405
|
-
|
|
1390
|
+
c({ context: computedContext, subscribe: true })
|
|
1406
1391
|
], TestNext.prototype, "computedContext", 2);
|
|
1407
1392
|
__decorateClass([
|
|
1408
1393
|
watch("computedContext")
|
|
1409
1394
|
], TestNext.prototype, "_handleTestElementChange", 1);
|
|
1410
1395
|
TestNext = __decorateClass([
|
|
1411
|
-
|
|
1396
|
+
t("test-next")
|
|
1412
1397
|
], TestNext);
|
|
1413
1398
|
|
|
1414
|
-
//
|
|
1415
|
-
|
|
1416
|
-
import { customElement as customElement7, property as property9 } from "lit/decorators.js";
|
|
1417
|
-
import { consume as consume5 } from "@lit/context";
|
|
1418
|
-
var TestPrev = class extends LitElement8 {
|
|
1399
|
+
// ../qti-test/src/components/test-prev/test-prev.ts
|
|
1400
|
+
var TestPrev = class extends i2 {
|
|
1419
1401
|
constructor() {
|
|
1420
1402
|
super();
|
|
1421
1403
|
this._internalDisabled = true;
|
|
1422
|
-
this.addEventListener("click", (
|
|
1423
|
-
|
|
1404
|
+
this.addEventListener("click", (e2) => {
|
|
1405
|
+
e2.preventDefault();
|
|
1424
1406
|
if (!this._internalDisabled) this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);
|
|
1425
1407
|
});
|
|
1426
1408
|
}
|
|
@@ -1453,10 +1435,10 @@ var TestPrev = class extends LitElement8 {
|
|
|
1453
1435
|
);
|
|
1454
1436
|
}
|
|
1455
1437
|
render() {
|
|
1456
|
-
return
|
|
1438
|
+
return x`<slot></slot>`;
|
|
1457
1439
|
}
|
|
1458
1440
|
};
|
|
1459
|
-
TestPrev.styles =
|
|
1441
|
+
TestPrev.styles = i`
|
|
1460
1442
|
:host {
|
|
1461
1443
|
${btn};
|
|
1462
1444
|
}
|
|
@@ -1465,23 +1447,20 @@ TestPrev.styles = css4`
|
|
|
1465
1447
|
}
|
|
1466
1448
|
`;
|
|
1467
1449
|
__decorateClass([
|
|
1468
|
-
|
|
1450
|
+
n({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
1469
1451
|
], TestPrev.prototype, "_internalDisabled", 2);
|
|
1470
1452
|
__decorateClass([
|
|
1471
|
-
|
|
1453
|
+
c({ context: computedContext, subscribe: true })
|
|
1472
1454
|
], TestPrev.prototype, "computedContext", 2);
|
|
1473
1455
|
__decorateClass([
|
|
1474
1456
|
watch("computedContext")
|
|
1475
1457
|
], TestPrev.prototype, "_handleTestElementChange", 1);
|
|
1476
1458
|
TestPrev = __decorateClass([
|
|
1477
|
-
|
|
1459
|
+
t("test-prev")
|
|
1478
1460
|
], TestPrev);
|
|
1479
1461
|
|
|
1480
|
-
//
|
|
1481
|
-
|
|
1482
|
-
import { customElement as customElement8, property as property10, state as state2 } from "lit/decorators.js";
|
|
1483
|
-
import { consume as consume6 } from "@lit/context";
|
|
1484
|
-
var TestView = class extends LitElement9 {
|
|
1462
|
+
// ../qti-test/src/components/test-view-toggle/test-view.ts
|
|
1463
|
+
var TestView = class extends i2 {
|
|
1485
1464
|
constructor() {
|
|
1486
1465
|
super(...arguments);
|
|
1487
1466
|
this.label = "view";
|
|
@@ -1512,18 +1491,18 @@ var TestView = class extends LitElement9 {
|
|
|
1512
1491
|
);
|
|
1513
1492
|
}
|
|
1514
1493
|
render() {
|
|
1515
|
-
return
|
|
1494
|
+
return x`
|
|
1516
1495
|
<label part="label" for="viewSelect">${this.label}</label>
|
|
1517
1496
|
<select
|
|
1518
1497
|
part="select"
|
|
1519
1498
|
id="viewSelect"
|
|
1520
|
-
@change=${(
|
|
1521
|
-
const el =
|
|
1499
|
+
@change=${(e2) => {
|
|
1500
|
+
const el = e2.target;
|
|
1522
1501
|
this._switchView(el.value);
|
|
1523
1502
|
}}
|
|
1524
1503
|
>
|
|
1525
1504
|
${this._viewOptions.map(
|
|
1526
|
-
(v) =>
|
|
1505
|
+
(v) => x`<option value="${v}" ?selected=${v === this.sessionContext.view}>${v}</option>`
|
|
1527
1506
|
)}
|
|
1528
1507
|
</select>
|
|
1529
1508
|
`;
|
|
@@ -1531,28 +1510,26 @@ var TestView = class extends LitElement9 {
|
|
|
1531
1510
|
};
|
|
1532
1511
|
TestView.DEFAULT_VIEW_OPTIONS = ["author", "candidate", "proctor", "scorer", "testConstructor", "tutor"];
|
|
1533
1512
|
__decorateClass([
|
|
1534
|
-
|
|
1513
|
+
c({ context: sessionContext, subscribe: true })
|
|
1535
1514
|
], TestView.prototype, "sessionContext", 2);
|
|
1536
1515
|
__decorateClass([
|
|
1537
|
-
|
|
1516
|
+
n({ type: String })
|
|
1538
1517
|
], TestView.prototype, "label", 2);
|
|
1539
1518
|
__decorateClass([
|
|
1540
|
-
|
|
1519
|
+
n({ type: String, attribute: "view-options" })
|
|
1541
1520
|
], TestView.prototype, "viewOptions", 2);
|
|
1542
1521
|
__decorateClass([
|
|
1543
1522
|
watch("viewOptions", { waitUntilFirstUpdate: true })
|
|
1544
1523
|
], TestView.prototype, "_handleViewOptionsChange", 2);
|
|
1545
1524
|
__decorateClass([
|
|
1546
|
-
|
|
1525
|
+
r()
|
|
1547
1526
|
], TestView.prototype, "_viewOptions", 2);
|
|
1548
1527
|
TestView = __decorateClass([
|
|
1549
|
-
|
|
1528
|
+
t("test-view")
|
|
1550
1529
|
], TestView);
|
|
1551
1530
|
|
|
1552
|
-
//
|
|
1553
|
-
|
|
1554
|
-
import { customElement as customElement9, property as property11 } from "lit/decorators.js";
|
|
1555
|
-
var TestItemLink = class extends LitElement10 {
|
|
1531
|
+
// ../qti-test/src/components/test-item-link/test-item-link.ts
|
|
1532
|
+
var TestItemLink = class extends i2 {
|
|
1556
1533
|
constructor() {
|
|
1557
1534
|
super();
|
|
1558
1535
|
this.itemId = null;
|
|
@@ -1571,10 +1548,10 @@ var TestItemLink = class extends LitElement10 {
|
|
|
1571
1548
|
);
|
|
1572
1549
|
}
|
|
1573
1550
|
render() {
|
|
1574
|
-
return
|
|
1551
|
+
return x` <slot></slot> `;
|
|
1575
1552
|
}
|
|
1576
1553
|
};
|
|
1577
|
-
TestItemLink.styles =
|
|
1554
|
+
TestItemLink.styles = i`
|
|
1578
1555
|
:host {
|
|
1579
1556
|
${btn};
|
|
1580
1557
|
}
|
|
@@ -1583,25 +1560,23 @@ TestItemLink.styles = css5`
|
|
|
1583
1560
|
}
|
|
1584
1561
|
`;
|
|
1585
1562
|
__decorateClass([
|
|
1586
|
-
|
|
1563
|
+
n({ type: String, attribute: "item-id" })
|
|
1587
1564
|
], TestItemLink.prototype, "itemId", 2);
|
|
1588
1565
|
TestItemLink = __decorateClass([
|
|
1589
|
-
|
|
1566
|
+
t("test-item-link")
|
|
1590
1567
|
], TestItemLink);
|
|
1591
1568
|
|
|
1592
|
-
//
|
|
1593
|
-
|
|
1594
|
-
import { customElement as customElement10 } from "lit/decorators.js";
|
|
1595
|
-
var TestEndAttempt = class extends LitElement11 {
|
|
1569
|
+
// ../qti-test/src/components/test-end-attempt/test-end-attempt.ts
|
|
1570
|
+
var TestEndAttempt = class extends i2 {
|
|
1596
1571
|
constructor() {
|
|
1597
1572
|
super();
|
|
1598
1573
|
this.addEventListener("click", () => this.dispatchEvent(new CustomEvent("test-end-attempt", { bubbles: true })));
|
|
1599
1574
|
}
|
|
1600
1575
|
render() {
|
|
1601
|
-
return
|
|
1576
|
+
return x` <slot></slot> `;
|
|
1602
1577
|
}
|
|
1603
1578
|
};
|
|
1604
|
-
TestEndAttempt.styles =
|
|
1579
|
+
TestEndAttempt.styles = i`
|
|
1605
1580
|
:host {
|
|
1606
1581
|
${btn};
|
|
1607
1582
|
}
|
|
@@ -1610,14 +1585,11 @@ TestEndAttempt.styles = css6`
|
|
|
1610
1585
|
}
|
|
1611
1586
|
`;
|
|
1612
1587
|
TestEndAttempt = __decorateClass([
|
|
1613
|
-
|
|
1588
|
+
t("test-end-attempt")
|
|
1614
1589
|
], TestEndAttempt);
|
|
1615
1590
|
|
|
1616
|
-
//
|
|
1617
|
-
|
|
1618
|
-
import { customElement as customElement11, property as property12 } from "lit/decorators.js";
|
|
1619
|
-
import { consume as consume7 } from "@lit/context";
|
|
1620
|
-
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 {
|
|
1621
1593
|
constructor() {
|
|
1622
1594
|
super(...arguments);
|
|
1623
1595
|
this.shown = false;
|
|
@@ -1657,10 +1629,10 @@ var TestShowCorrectResponse = class extends LitElement12 {
|
|
|
1657
1629
|
return this.disabled ? this.noCorrectResponseText : this.shown ? this.hideCorrectText : this.showCorrectText;
|
|
1658
1630
|
}
|
|
1659
1631
|
render() {
|
|
1660
|
-
return
|
|
1632
|
+
return x` <div @click="${this._toggleState}">${this._getDisplayedText()}</div> `;
|
|
1661
1633
|
}
|
|
1662
1634
|
};
|
|
1663
|
-
TestShowCorrectResponse.styles =
|
|
1635
|
+
TestShowCorrectResponse.styles = i`
|
|
1664
1636
|
:host {
|
|
1665
1637
|
${btn};
|
|
1666
1638
|
}
|
|
@@ -1669,33 +1641,1112 @@ TestShowCorrectResponse.styles = css7`
|
|
|
1669
1641
|
}
|
|
1670
1642
|
`;
|
|
1671
1643
|
__decorateClass([
|
|
1672
|
-
|
|
1644
|
+
c({ context: computedContext, subscribe: true })
|
|
1673
1645
|
], TestShowCorrectResponse.prototype, "computedContext", 2);
|
|
1674
1646
|
__decorateClass([
|
|
1675
|
-
|
|
1647
|
+
n({ type: Boolean, reflect: true })
|
|
1676
1648
|
], TestShowCorrectResponse.prototype, "shown", 2);
|
|
1677
1649
|
__decorateClass([
|
|
1678
|
-
|
|
1650
|
+
n({ type: Boolean, reflect: true })
|
|
1679
1651
|
], TestShowCorrectResponse.prototype, "disabled", 2);
|
|
1680
1652
|
__decorateClass([
|
|
1681
|
-
|
|
1653
|
+
n({ type: String })
|
|
1682
1654
|
], TestShowCorrectResponse.prototype, "showCorrectText", 2);
|
|
1683
1655
|
__decorateClass([
|
|
1684
|
-
|
|
1656
|
+
n({ type: String })
|
|
1685
1657
|
], TestShowCorrectResponse.prototype, "hideCorrectText", 2);
|
|
1686
1658
|
__decorateClass([
|
|
1687
|
-
|
|
1659
|
+
n({ type: String })
|
|
1688
1660
|
], TestShowCorrectResponse.prototype, "noCorrectResponseText", 2);
|
|
1689
1661
|
TestShowCorrectResponse = __decorateClass([
|
|
1690
|
-
|
|
1662
|
+
t("test-show-correct-response")
|
|
1691
1663
|
], TestShowCorrectResponse);
|
|
1692
1664
|
|
|
1693
|
-
//
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
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 {
|
|
1699
2750
|
createRenderRoot() {
|
|
1700
2751
|
return this;
|
|
1701
2752
|
}
|
|
@@ -1710,25 +2761,22 @@ var TestPagingButtonsStamp = class extends LitElement13 {
|
|
|
1710
2761
|
this.myTemplate = prepareTemplate(templateElement);
|
|
1711
2762
|
}
|
|
1712
2763
|
render() {
|
|
1713
|
-
if (!this.computedContext) return
|
|
2764
|
+
if (!this.computedContext) return x``;
|
|
1714
2765
|
const items = this.computedContext.testParts.flatMap(
|
|
1715
2766
|
(testPart) => testPart.sections.flatMap((section) => section.items)
|
|
1716
2767
|
);
|
|
1717
|
-
return
|
|
2768
|
+
return x` ${items.map((item) => this.myTemplate({ item, view: this.computedContext.view }))} `;
|
|
1718
2769
|
}
|
|
1719
2770
|
};
|
|
1720
2771
|
__decorateClass([
|
|
1721
|
-
|
|
2772
|
+
c({ context: computedContext, subscribe: true })
|
|
1722
2773
|
], TestPagingButtonsStamp.prototype, "computedContext", 2);
|
|
1723
2774
|
TestPagingButtonsStamp = __decorateClass([
|
|
1724
|
-
|
|
2775
|
+
t("test-paging-buttons-stamp")
|
|
1725
2776
|
], TestPagingButtonsStamp);
|
|
1726
2777
|
|
|
1727
|
-
//
|
|
1728
|
-
|
|
1729
|
-
import { customElement as customElement13, property as property13, state as state3 } from "lit/decorators.js";
|
|
1730
|
-
import { until } from "lit/directives/until.js";
|
|
1731
|
-
var TestContainer = class extends LitElement14 {
|
|
2778
|
+
// ../qti-test/src/components/test-container/test-container.ts
|
|
2779
|
+
var TestContainer = class extends i2 {
|
|
1732
2780
|
constructor() {
|
|
1733
2781
|
super(...arguments);
|
|
1734
2782
|
this.testURL = null;
|
|
@@ -1775,7 +2823,7 @@ var TestContainer = class extends LitElement14 {
|
|
|
1775
2823
|
}
|
|
1776
2824
|
initializeTemplateContent() {
|
|
1777
2825
|
const template = this.querySelector("template");
|
|
1778
|
-
this.templateContent = template ? template.content :
|
|
2826
|
+
this.templateContent = template ? template.content : x``;
|
|
1779
2827
|
}
|
|
1780
2828
|
applyStyles() {
|
|
1781
2829
|
const sheet = new CSSStyleSheet();
|
|
@@ -1783,21 +2831,21 @@ var TestContainer = class extends LitElement14 {
|
|
|
1783
2831
|
this.shadowRoot.adoptedStyleSheets = [sheet];
|
|
1784
2832
|
}
|
|
1785
2833
|
render() {
|
|
1786
|
-
return
|
|
2834
|
+
return x`
|
|
1787
2835
|
${this.templateContent}
|
|
1788
2836
|
<slot></slot>
|
|
1789
|
-
${
|
|
2837
|
+
${m(this.testDoc, x`<span>Loading...</span>`)}
|
|
1790
2838
|
`;
|
|
1791
2839
|
}
|
|
1792
2840
|
};
|
|
1793
2841
|
__decorateClass([
|
|
1794
|
-
|
|
2842
|
+
n({ type: String, attribute: "test-url" })
|
|
1795
2843
|
], TestContainer.prototype, "testURL", 2);
|
|
1796
2844
|
__decorateClass([
|
|
1797
|
-
|
|
2845
|
+
r()
|
|
1798
2846
|
], TestContainer.prototype, "testDoc", 2);
|
|
1799
2847
|
__decorateClass([
|
|
1800
|
-
|
|
2848
|
+
r()
|
|
1801
2849
|
], TestContainer.prototype, "testXML", 2);
|
|
1802
2850
|
__decorateClass([
|
|
1803
2851
|
watch("testURL", { waitUntilFirstUpdate: true })
|
|
@@ -1806,20 +2854,17 @@ __decorateClass([
|
|
|
1806
2854
|
watch("testXML", { waitUntilFirstUpdate: true })
|
|
1807
2855
|
], TestContainer.prototype, "handleTestXMLChange", 1);
|
|
1808
2856
|
TestContainer = __decorateClass([
|
|
1809
|
-
|
|
2857
|
+
t("test-container")
|
|
1810
2858
|
], TestContainer);
|
|
1811
2859
|
|
|
1812
|
-
//
|
|
1813
|
-
|
|
1814
|
-
import { consume as consume9 } from "@lit/context";
|
|
1815
|
-
import { customElement as customElement14 } from "lit/decorators.js";
|
|
1816
|
-
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 {
|
|
1817
2862
|
render() {
|
|
1818
2863
|
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
1819
|
-
if (!activeItem || !activeItem.variables) return
|
|
2864
|
+
if (!activeItem || !activeItem.variables) return x``;
|
|
1820
2865
|
const responseVariables = activeItem.variables.filter((v) => v.type === "response");
|
|
1821
2866
|
const outcomeVariables = activeItem.variables.filter((v) => v.type === "outcome");
|
|
1822
|
-
const renderTable = (variables, title) =>
|
|
2867
|
+
const renderTable = (variables, title) => x`
|
|
1823
2868
|
<h3>${title}</h3>
|
|
1824
2869
|
<table>
|
|
1825
2870
|
<thead>
|
|
@@ -1834,9 +2879,9 @@ var TestPrintVariables = class extends LitElement15 {
|
|
|
1834
2879
|
<tbody>
|
|
1835
2880
|
${variables.map((v) => {
|
|
1836
2881
|
const correctResponse = v.correctResponse ? Array.isArray(v.correctResponse) ? v.correctResponse.join(", ") : v.correctResponse : "";
|
|
1837
|
-
const mapEntries = v.mapping?.mapEntries?.map((
|
|
1838
|
-
const areaMapEntries = v.areaMapping?.areaMapEntries?.map((
|
|
1839
|
-
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`
|
|
1840
2885
|
<tr>
|
|
1841
2886
|
<td>${v.identifier}</td>
|
|
1842
2887
|
<td>${Array.isArray(v.value) ? v.value.join(", ") : v.value}</td>
|
|
@@ -1849,12 +2894,12 @@ var TestPrintVariables = class extends LitElement15 {
|
|
|
1849
2894
|
</tbody>
|
|
1850
2895
|
</table>
|
|
1851
2896
|
`;
|
|
1852
|
-
return
|
|
2897
|
+
return x`
|
|
1853
2898
|
${renderTable(responseVariables, "Response Variables")} ${renderTable(outcomeVariables, "Outcome Variables")}
|
|
1854
2899
|
`;
|
|
1855
2900
|
}
|
|
1856
2901
|
};
|
|
1857
|
-
TestPrintVariables.styles =
|
|
2902
|
+
TestPrintVariables.styles = i`
|
|
1858
2903
|
table {
|
|
1859
2904
|
width: 100%;
|
|
1860
2905
|
border-collapse: collapse;
|
|
@@ -1877,18 +2922,14 @@ TestPrintVariables.styles = css8`
|
|
|
1877
2922
|
}
|
|
1878
2923
|
`;
|
|
1879
2924
|
__decorateClass([
|
|
1880
|
-
|
|
2925
|
+
c({ context: computedContext, subscribe: true })
|
|
1881
2926
|
], TestPrintVariables.prototype, "computedContext", 2);
|
|
1882
2927
|
TestPrintVariables = __decorateClass([
|
|
1883
|
-
|
|
2928
|
+
t("test-print-item-variables")
|
|
1884
2929
|
], TestPrintVariables);
|
|
1885
2930
|
|
|
1886
|
-
//
|
|
1887
|
-
|
|
1888
|
-
import { customElement as customElement15 } from "lit/decorators.js";
|
|
1889
|
-
import { prepareTemplate as prepareTemplate2 } from "@heximal/templates";
|
|
1890
|
-
import { consume as consume10 } from "@lit/context";
|
|
1891
|
-
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 {
|
|
1892
2933
|
createRenderRoot() {
|
|
1893
2934
|
return this;
|
|
1894
2935
|
}
|
|
@@ -1900,25 +2941,23 @@ var TestSectionButtonsStamp = class extends LitElement16 {
|
|
|
1900
2941
|
connectedCallback() {
|
|
1901
2942
|
super.connectedCallback();
|
|
1902
2943
|
const templateElement = this.querySelector("template");
|
|
1903
|
-
this.myTemplate =
|
|
2944
|
+
this.myTemplate = prepareTemplate(templateElement);
|
|
1904
2945
|
}
|
|
1905
2946
|
render() {
|
|
1906
|
-
if (!this.computedContext) return
|
|
2947
|
+
if (!this.computedContext) return x``;
|
|
1907
2948
|
const sections = this.computedContext.testParts.flatMap((testPart) => testPart.sections);
|
|
1908
|
-
return
|
|
2949
|
+
return x` ${sections.map((item) => this.myTemplate({ item }))} `;
|
|
1909
2950
|
}
|
|
1910
2951
|
};
|
|
1911
2952
|
__decorateClass([
|
|
1912
|
-
|
|
2953
|
+
c({ context: computedContext, subscribe: true })
|
|
1913
2954
|
], TestSectionButtonsStamp.prototype, "computedContext", 2);
|
|
1914
2955
|
TestSectionButtonsStamp = __decorateClass([
|
|
1915
|
-
|
|
2956
|
+
t("test-section-buttons-stamp")
|
|
1916
2957
|
], TestSectionButtonsStamp);
|
|
1917
2958
|
|
|
1918
|
-
//
|
|
1919
|
-
|
|
1920
|
-
import { customElement as customElement16, property as property14 } from "lit/decorators.js";
|
|
1921
|
-
var TestSectionLink = class extends LitElement17 {
|
|
2959
|
+
// ../qti-test/src/components/test-section-link/test-section-link.ts
|
|
2960
|
+
var TestSectionLink = class extends i2 {
|
|
1922
2961
|
constructor() {
|
|
1923
2962
|
super();
|
|
1924
2963
|
this.sectionId = null;
|
|
@@ -1937,10 +2976,10 @@ var TestSectionLink = class extends LitElement17 {
|
|
|
1937
2976
|
);
|
|
1938
2977
|
}
|
|
1939
2978
|
render() {
|
|
1940
|
-
return
|
|
2979
|
+
return x` <slot></slot> `;
|
|
1941
2980
|
}
|
|
1942
2981
|
};
|
|
1943
|
-
TestSectionLink.styles =
|
|
2982
|
+
TestSectionLink.styles = i`
|
|
1944
2983
|
:host {
|
|
1945
2984
|
${btn};
|
|
1946
2985
|
}
|
|
@@ -1949,35 +2988,28 @@ TestSectionLink.styles = css9`
|
|
|
1949
2988
|
}
|
|
1950
2989
|
`;
|
|
1951
2990
|
__decorateClass([
|
|
1952
|
-
|
|
2991
|
+
n({ type: String, attribute: "section-id" })
|
|
1953
2992
|
], TestSectionLink.prototype, "sectionId", 2);
|
|
1954
2993
|
TestSectionLink = __decorateClass([
|
|
1955
|
-
|
|
2994
|
+
t("test-section-link")
|
|
1956
2995
|
], TestSectionLink);
|
|
1957
2996
|
|
|
1958
|
-
//
|
|
1959
|
-
|
|
1960
|
-
import { consume as consume11 } from "@lit/context";
|
|
1961
|
-
import { customElement as customElement17, state as state4 } from "lit/decorators.js";
|
|
1962
|
-
var TestPrintContext = class extends LitElement18 {
|
|
2997
|
+
// ../qti-test/src/components/test-print-context/test-print-context.ts
|
|
2998
|
+
var TestPrintContext = class extends i2 {
|
|
1963
2999
|
render() {
|
|
1964
|
-
return
|
|
3000
|
+
return x` <small><pre>${JSON.stringify(this.computedContext, null, 2)}</pre></small> `;
|
|
1965
3001
|
}
|
|
1966
3002
|
};
|
|
1967
3003
|
__decorateClass([
|
|
1968
|
-
|
|
1969
|
-
|
|
3004
|
+
r(),
|
|
3005
|
+
c({ context: computedContext, subscribe: true })
|
|
1970
3006
|
], TestPrintContext.prototype, "computedContext", 2);
|
|
1971
3007
|
TestPrintContext = __decorateClass([
|
|
1972
|
-
|
|
3008
|
+
t("test-print-context")
|
|
1973
3009
|
], TestPrintContext);
|
|
1974
3010
|
|
|
1975
|
-
//
|
|
1976
|
-
|
|
1977
|
-
import { customElement as customElement18, property as property15, state as state5 } from "lit/decorators.js";
|
|
1978
|
-
import { prepareTemplate as prepareTemplate3 } from "@heximal/templates";
|
|
1979
|
-
import { consume as consume12 } from "@lit/context";
|
|
1980
|
-
var TestStamp = class extends LitElement19 {
|
|
3011
|
+
// ../qti-test/src/components/test-stamp/test-stamp.ts
|
|
3012
|
+
var TestStamp = class extends i2 {
|
|
1981
3013
|
constructor() {
|
|
1982
3014
|
super(...arguments);
|
|
1983
3015
|
this.debug = false;
|
|
@@ -2004,7 +3036,7 @@ var TestStamp = class extends LitElement19 {
|
|
|
2004
3036
|
this.myTemplate = null;
|
|
2005
3037
|
return;
|
|
2006
3038
|
}
|
|
2007
|
-
this.myTemplate =
|
|
3039
|
+
this.myTemplate = prepareTemplate(templateElement);
|
|
2008
3040
|
}
|
|
2009
3041
|
willUpdate(_changedProperties) {
|
|
2010
3042
|
if (!this.computedContext) {
|
|
@@ -2042,37 +3074,33 @@ var TestStamp = class extends LitElement19 {
|
|
|
2042
3074
|
);
|
|
2043
3075
|
}
|
|
2044
3076
|
render() {
|
|
2045
|
-
return
|
|
2046
|
-
${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}`;
|
|
2047
3079
|
}
|
|
2048
3080
|
};
|
|
2049
3081
|
__decorateClass([
|
|
2050
|
-
|
|
3082
|
+
n({ type: Boolean, reflect: true })
|
|
2051
3083
|
], TestStamp.prototype, "debug", 2);
|
|
2052
3084
|
__decorateClass([
|
|
2053
|
-
|
|
2054
|
-
|
|
3085
|
+
r(),
|
|
3086
|
+
c({ context: computedContext, subscribe: true })
|
|
2055
3087
|
], TestStamp.prototype, "computedContext", 2);
|
|
2056
3088
|
__decorateClass([
|
|
2057
|
-
|
|
3089
|
+
r()
|
|
2058
3090
|
], TestStamp.prototype, "stampContext", 2);
|
|
2059
3091
|
TestStamp = __decorateClass([
|
|
2060
|
-
|
|
3092
|
+
t("test-stamp")
|
|
2061
3093
|
], TestStamp);
|
|
2062
3094
|
|
|
2063
|
-
//
|
|
2064
|
-
|
|
2065
|
-
import { consume as consume13 } from "@lit/context";
|
|
2066
|
-
import { customElement as customElement19, property as property16 } from "lit/decorators.js";
|
|
2067
|
-
import { prepareTemplate as prepareTemplate4 } from "@heximal/templates";
|
|
2068
|
-
var TestScoringButtons = class extends LitElement20 {
|
|
3095
|
+
// ../qti-test/src/components/test-scoring-buttons/test-scoring-buttons.ts
|
|
3096
|
+
var TestScoringButtons = class extends i2 {
|
|
2069
3097
|
constructor() {
|
|
2070
3098
|
super();
|
|
2071
3099
|
this.view = "";
|
|
2072
3100
|
this.disabled = false;
|
|
2073
3101
|
this.myTemplate = null;
|
|
2074
|
-
this.addEventListener("click", (
|
|
2075
|
-
const target =
|
|
3102
|
+
this.addEventListener("click", (e2) => {
|
|
3103
|
+
const target = e2.target;
|
|
2076
3104
|
const value = parseFloat(target.value);
|
|
2077
3105
|
if (target.tagName === "INPUT") {
|
|
2078
3106
|
this._changeOutcomeScore(value);
|
|
@@ -2089,7 +3117,7 @@ var TestScoringButtons = class extends LitElement20 {
|
|
|
2089
3117
|
this.myTemplate = null;
|
|
2090
3118
|
return;
|
|
2091
3119
|
}
|
|
2092
|
-
this.myTemplate =
|
|
3120
|
+
this.myTemplate = prepareTemplate(templateElement);
|
|
2093
3121
|
}
|
|
2094
3122
|
_changeOutcomeScore(value) {
|
|
2095
3123
|
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
@@ -2108,35 +3136,31 @@ var TestScoringButtons = class extends LitElement20 {
|
|
|
2108
3136
|
}
|
|
2109
3137
|
render() {
|
|
2110
3138
|
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
2111
|
-
if (!activeItem || !activeItem.variables) return
|
|
3139
|
+
if (!activeItem || !activeItem.variables) return x``;
|
|
2112
3140
|
const maxScore = activeItem.variables.find((vr) => vr.identifier == "MAXSCORE")?.value;
|
|
2113
3141
|
const scoreOutcome = activeItem.variables.find((vr) => vr.identifier == "SCORE");
|
|
2114
3142
|
const score = scoreOutcome?.value;
|
|
2115
3143
|
const disabled = !(scoreOutcome?.externalScored === "human");
|
|
2116
|
-
if (!maxScore || !scoreOutcome) return
|
|
3144
|
+
if (!maxScore || !scoreOutcome) return E;
|
|
2117
3145
|
const scores = [...Array(Number(maxScore) + 1).keys()];
|
|
2118
|
-
return
|
|
3146
|
+
return x`${this.myTemplate ? this.myTemplate({ scores, score, disabled }) : E}`;
|
|
2119
3147
|
}
|
|
2120
3148
|
};
|
|
2121
3149
|
__decorateClass([
|
|
2122
|
-
|
|
3150
|
+
n({ type: String, attribute: "view" })
|
|
2123
3151
|
], TestScoringButtons.prototype, "view", 2);
|
|
2124
3152
|
__decorateClass([
|
|
2125
|
-
|
|
3153
|
+
n({ type: Boolean })
|
|
2126
3154
|
], TestScoringButtons.prototype, "disabled", 2);
|
|
2127
3155
|
__decorateClass([
|
|
2128
|
-
|
|
3156
|
+
c({ context: computedContext, subscribe: true })
|
|
2129
3157
|
], TestScoringButtons.prototype, "computedContext", 2);
|
|
2130
3158
|
TestScoringButtons = __decorateClass([
|
|
2131
|
-
|
|
3159
|
+
t("test-scoring-buttons")
|
|
2132
3160
|
], TestScoringButtons);
|
|
2133
3161
|
|
|
2134
|
-
//
|
|
2135
|
-
|
|
2136
|
-
import { html as html21, LitElement as LitElement21, nothing as nothing3 } from "lit";
|
|
2137
|
-
import { customElement as customElement20 } from "lit/decorators.js";
|
|
2138
|
-
import { prepareTemplate as prepareTemplate5 } from "@heximal/templates";
|
|
2139
|
-
var TestViewToggle = class extends LitElement21 {
|
|
3162
|
+
// ../qti-test/src/components/test-view-toggle/test-view-toggle.ts
|
|
3163
|
+
var TestViewToggle = class extends i2 {
|
|
2140
3164
|
createRenderRoot() {
|
|
2141
3165
|
return this;
|
|
2142
3166
|
}
|
|
@@ -2147,7 +3171,7 @@ var TestViewToggle = class extends LitElement21 {
|
|
|
2147
3171
|
this.myTemplate = null;
|
|
2148
3172
|
return;
|
|
2149
3173
|
}
|
|
2150
|
-
this.myTemplate =
|
|
3174
|
+
this.myTemplate = prepareTemplate(templateElement);
|
|
2151
3175
|
}
|
|
2152
3176
|
_switchView(view) {
|
|
2153
3177
|
this.dispatchEvent(
|
|
@@ -2168,31 +3192,28 @@ var TestViewToggle = class extends LitElement21 {
|
|
|
2168
3192
|
});
|
|
2169
3193
|
}
|
|
2170
3194
|
render() {
|
|
2171
|
-
return
|
|
3195
|
+
return x`${this.myTemplate ? this.myTemplate({
|
|
2172
3196
|
view: this.sessionContext?.view
|
|
2173
|
-
}) :
|
|
3197
|
+
}) : E}`;
|
|
2174
3198
|
}
|
|
2175
3199
|
};
|
|
2176
3200
|
__decorateClass([
|
|
2177
|
-
|
|
3201
|
+
c({ context: sessionContext, subscribe: true })
|
|
2178
3202
|
], TestViewToggle.prototype, "sessionContext", 2);
|
|
2179
3203
|
TestViewToggle = __decorateClass([
|
|
2180
|
-
|
|
3204
|
+
t("test-view-toggle")
|
|
2181
3205
|
], TestViewToggle);
|
|
2182
3206
|
|
|
2183
|
-
//
|
|
2184
|
-
|
|
2185
|
-
import { html as html22, LitElement as LitElement22 } from "lit";
|
|
2186
|
-
import { customElement as customElement21, property as property17 } from "lit/decorators.js";
|
|
2187
|
-
var TestScoringFeedback = class extends LitElement22 {
|
|
3207
|
+
// ../qti-test/src/components/test-scoring-feedback/test-scoring-feedback.ts
|
|
3208
|
+
var TestScoringFeedback = class extends i2 {
|
|
2188
3209
|
constructor() {
|
|
2189
3210
|
super(...arguments);
|
|
2190
3211
|
this.view = null;
|
|
2191
3212
|
}
|
|
2192
3213
|
render() {
|
|
2193
3214
|
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
2194
|
-
if (!activeItem || !activeItem.variables) return
|
|
2195
|
-
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>`;
|
|
2196
3217
|
const completionStatus = activeItem?.variables.find((v) => v.identifier === "completionStatus")?.value;
|
|
2197
3218
|
const scoreOutcome = activeItem?.variables.find((vr) => vr.identifier == "SCORE");
|
|
2198
3219
|
const score = parseFloat(scoreOutcome?.value);
|
|
@@ -2212,23 +3233,21 @@ var TestScoringFeedback = class extends LitElement22 {
|
|
|
2212
3233
|
}
|
|
2213
3234
|
return this.dataset.inProgress;
|
|
2214
3235
|
};
|
|
2215
|
-
return
|
|
3236
|
+
return x`<div>${feedbackText()}</div>`;
|
|
2216
3237
|
}
|
|
2217
3238
|
};
|
|
2218
3239
|
__decorateClass([
|
|
2219
|
-
|
|
3240
|
+
c({ context: computedContext, subscribe: true })
|
|
2220
3241
|
], TestScoringFeedback.prototype, "computedContext", 2);
|
|
2221
3242
|
__decorateClass([
|
|
2222
|
-
|
|
3243
|
+
n({ type: String, attribute: "view" })
|
|
2223
3244
|
], TestScoringFeedback.prototype, "view", 2);
|
|
2224
3245
|
TestScoringFeedback = __decorateClass([
|
|
2225
|
-
|
|
3246
|
+
t("test-scoring-feedback")
|
|
2226
3247
|
], TestScoringFeedback);
|
|
2227
3248
|
|
|
2228
|
-
//
|
|
2229
|
-
|
|
2230
|
-
import { customElement as customElement22 } from "lit/decorators.js";
|
|
2231
|
-
var TestCheckItem = class extends LitElement23 {
|
|
3249
|
+
// ../qti-test/src/components/test-check-item/test-check-item.ts
|
|
3250
|
+
var TestCheckItem = class extends i2 {
|
|
2232
3251
|
constructor() {
|
|
2233
3252
|
super();
|
|
2234
3253
|
this.addEventListener("click", () => {
|
|
@@ -2248,10 +3267,10 @@ var TestCheckItem = class extends LitElement23 {
|
|
|
2248
3267
|
});
|
|
2249
3268
|
}
|
|
2250
3269
|
render() {
|
|
2251
|
-
return
|
|
3270
|
+
return x` <slot></slot> `;
|
|
2252
3271
|
}
|
|
2253
3272
|
};
|
|
2254
|
-
TestCheckItem.styles =
|
|
3273
|
+
TestCheckItem.styles = i`
|
|
2255
3274
|
:host {
|
|
2256
3275
|
${btn};
|
|
2257
3276
|
}
|
|
@@ -2260,7 +3279,7 @@ TestCheckItem.styles = css10`
|
|
|
2260
3279
|
}
|
|
2261
3280
|
`;
|
|
2262
3281
|
TestCheckItem = __decorateClass([
|
|
2263
|
-
|
|
3282
|
+
t("test-check-item")
|
|
2264
3283
|
], TestCheckItem);
|
|
2265
3284
|
|
|
2266
3285
|
export {
|
|
@@ -2289,4 +3308,23 @@ export {
|
|
|
2289
3308
|
TestScoringFeedback,
|
|
2290
3309
|
TestCheckItem
|
|
2291
3310
|
};
|
|
2292
|
-
|
|
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
|