@citolab/qti-components 9.0.0 → 9.2.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 +220 -212
- package/dist/base.d.ts +54 -11
- package/dist/base.js +11 -1
- package/dist/{chunk-GBDTBHUQ.js → chunk-7PXUE2GR.js} +3376 -3252
- package/dist/chunk-7PXUE2GR.js.map +1 -0
- package/dist/chunk-A32YH4H5.js +7 -0
- package/dist/chunk-A32YH4H5.js.map +1 -0
- package/dist/{chunk-MKZ374OJ.js → chunk-FG5JAWSN.js} +2 -2
- package/dist/{chunk-3VQSUWCK.js → chunk-G5RQ5GKG.js} +407 -131
- package/dist/chunk-G5RQ5GKG.js.map +1 -0
- package/dist/{chunk-WTV7NQHO.js → chunk-GPGUXZ3X.js} +20 -6
- package/dist/{chunk-WTV7NQHO.js.map → chunk-GPGUXZ3X.js.map} +1 -1
- package/dist/{chunk-5BXJRO5O.js → chunk-JGPWBIVD.js} +389 -229
- package/dist/chunk-JGPWBIVD.js.map +1 -0
- package/dist/{chunk-RT6WZ3P7.js → chunk-JLZCZVRX.js} +2 -2
- package/dist/{chunk-6ITD55QE.js → chunk-LFVPS7KB.js} +2 -2
- package/dist/{chunk-3MQNPN7A.js → chunk-RAJQKCQ3.js} +68 -11
- package/dist/chunk-RAJQKCQ3.js.map +1 -0
- package/dist/{chunk-WKWCOV5P.js → chunk-REKCRWJV.js} +83 -21
- package/dist/chunk-REKCRWJV.js.map +1 -0
- package/dist/{chunk-HDEG6BAZ.js → chunk-TLAVOBEM.js} +16 -8
- package/dist/chunk-TLAVOBEM.js.map +1 -0
- package/dist/{chunk-3NPCS4IT.js → chunk-YIYHCHHM.js} +2 -2
- package/dist/{chunk-WCWJPIUQ.js → chunk-YVZWNLF4.js} +191 -52
- package/dist/chunk-YVZWNLF4.js.map +1 -0
- package/dist/{chunk-KCK27QBP.js → chunk-ZG7FBQFP.js} +2 -2
- package/dist/{chunk-DXEWBTJB.js → chunk-ZOQVTG5L.js} +2 -2
- package/dist/{computed.types.d-CJarqC6s.d.ts → computed.types.d-DB5gfOh9.d.ts} +2 -16
- package/dist/corrections.d.ts +21 -10
- package/dist/corrections.js +20 -20
- package/dist/corrections.js.map +1 -1
- package/dist/elements.d.ts +43 -11
- package/dist/elements.js +4 -4
- package/dist/index.d.ts +14 -13
- package/dist/index.js +37 -15
- package/dist/{interaction.d-CJiMv8H7.d.ts → interaction.d-DegNJ5ZA.d.ts} +1 -1
- package/dist/interactions.d.ts +35 -35
- package/dist/interactions.js +3 -3
- package/dist/item.css +11 -2
- package/dist/item.d.ts +31 -82
- package/dist/item.js +7 -5
- package/dist/{item.types.d-QU7LljEK.d.ts → item.types.d-BDFrq19E.d.ts} +18 -2
- package/dist/loader.d.ts +3 -3
- package/dist/loader.js +2 -2
- package/dist/processing.d.ts +139 -20
- package/dist/processing.js +11 -3
- package/dist/qti-components-jsx.d.ts +1947 -98
- package/dist/{qti-condition-expression.d-CYwXOUb1.d.ts → qti-condition-expression.d-DLboq8bR.d.ts} +1 -1
- package/dist/{qti-expression.d-B_-m9emA.d.ts → qti-expression.d-BksT9iLB.d.ts} +26 -3
- package/dist/{qti-feedback.d-B1EIF-fU.d.ts → qti-feedback.d-D-w6-mJv.d.ts} +1 -1
- package/dist/qti-item.d-D_-9_0e6.d.ts +101 -0
- package/dist/qti-rule-base.d-Bdzg8eGH.d.ts +41 -0
- package/dist/{qti-test.d-C6lCEMRB.d.ts → qti-test.d-BfAZE6UF.d.ts} +61 -9
- package/dist/{qti-text-entry-interaction.d-BGdfV9qG.d.ts → qti-text-entry-interaction.d-CATtcPyX.d.ts} +10 -9
- package/dist/session.context.d-Cjs0BkJB.d.ts +33 -0
- package/dist/test.d.ts +8 -8
- package/dist/test.js +8 -6
- package/dist/transformers.js +1 -1
- package/package.json +13 -12
- package/dist/chunk-3MQNPN7A.js.map +0 -1
- package/dist/chunk-3VQSUWCK.js.map +0 -1
- package/dist/chunk-5BXJRO5O.js.map +0 -1
- package/dist/chunk-GBDTBHUQ.js.map +0 -1
- package/dist/chunk-HDEG6BAZ.js.map +0 -1
- package/dist/chunk-TLTYXWW7.js +0 -7
- package/dist/chunk-TLTYXWW7.js.map +0 -1
- package/dist/chunk-WCWJPIUQ.js.map +0 -1
- package/dist/chunk-WKWCOV5P.js.map +0 -1
- package/dist/computed-item.types.d-BKZdSLLJ.d.ts +0 -19
- package/dist/qti-rule-base.d-ajOnfGXY.d.ts +0 -16
- /package/dist/{chunk-MKZ374OJ.js.map → chunk-FG5JAWSN.js.map} +0 -0
- /package/dist/{chunk-RT6WZ3P7.js.map → chunk-JLZCZVRX.js.map} +0 -0
- /package/dist/{chunk-6ITD55QE.js.map → chunk-LFVPS7KB.js.map} +0 -0
- /package/dist/{chunk-3NPCS4IT.js.map → chunk-YIYHCHHM.js.map} +0 -0
- /package/dist/{chunk-KCK27QBP.js.map → chunk-ZG7FBQFP.js.map} +0 -0
- /package/dist/{chunk-DXEWBTJB.js.map → chunk-ZOQVTG5L.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { b as ItemContext, V as VariableDeclaration, g as ResponseVariable, B as BaseType } from './item.types.d-BDFrq19E.js';
|
|
4
|
+
import { a as QtiContextType, Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
|
|
5
5
|
|
|
6
6
|
interface TestContext {
|
|
7
7
|
items: (ItemContext & {
|
|
@@ -14,15 +14,38 @@ declare const testContext: {
|
|
|
14
14
|
__context__: Readonly<TestContext>;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
type ExpressionVariable = ResponseVariable | VariableDeclaration<QtiContextType>;
|
|
17
18
|
interface QtiExpressionBase<T> {
|
|
18
19
|
calculate(): Readonly<T>;
|
|
19
20
|
}
|
|
20
21
|
declare abstract class QtiExpression<T> extends LitElement implements QtiExpressionBase<T> {
|
|
22
|
+
#private;
|
|
21
23
|
protected result: any;
|
|
24
|
+
/**
|
|
25
|
+
* What the last `calculate()` produced, or undefined if it has not run.
|
|
26
|
+
*
|
|
27
|
+
* This is the supported way to inspect a scoring run: process the responses,
|
|
28
|
+
* then walk the rule tree reading this off each expression. A tool that wants
|
|
29
|
+
* to visualise how a score came about gets the whole tree annotated with its
|
|
30
|
+
* values, without the components having to re-render to show them.
|
|
31
|
+
*/
|
|
32
|
+
get lastResult(): Readonly<T> | undefined;
|
|
33
|
+
get lastVariables(): readonly ExpressionVariable[];
|
|
22
34
|
static styles: lit.CSSResult;
|
|
23
35
|
render(): lit.TemplateResult<1>;
|
|
36
|
+
protected shouldUpdate(): boolean;
|
|
24
37
|
calculate(): Readonly<T>;
|
|
25
38
|
protected getResult(): Readonly<T>;
|
|
39
|
+
/**
|
|
40
|
+
* The base type this operator always produces, when the QTI vocabulary fixes
|
|
41
|
+
* one regardless of its operands — `qti-divide` is a float even dividing two
|
|
42
|
+
* integers exactly, and `qti-round` is an integer whatever it rounds.
|
|
43
|
+
*
|
|
44
|
+
* Left undefined by operators whose result type follows their operands (a
|
|
45
|
+
* `qti-sum` of integers is an integer) and by those that return no number at
|
|
46
|
+
* all; the type is then read off the value.
|
|
47
|
+
*/
|
|
48
|
+
get resultBaseType(): BaseType | undefined;
|
|
26
49
|
protected context?: ItemContext;
|
|
27
50
|
protected qtiContext?: QtiContext;
|
|
28
51
|
protected _testContext?: TestContext;
|
|
@@ -35,7 +58,7 @@ declare abstract class QtiExpression<T> extends LitElement implements QtiExpress
|
|
|
35
58
|
* throwing, so callers degrade gracefully.
|
|
36
59
|
*/
|
|
37
60
|
protected resolveVariable(identifier: string): VariableDeclaration<string | string[] | null> | null;
|
|
38
|
-
getVariables: () =>
|
|
61
|
+
getVariables: () => ExpressionVariable[];
|
|
39
62
|
}
|
|
40
63
|
|
|
41
64
|
export { INITIAL_TEST_CONTEXT as I, QtiExpression as Q, type TestContext as T, type QtiExpressionBase as a, testContext as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
|
-
import { a as Cardinality } from './item.types.d-
|
|
3
|
+
import { a as Cardinality } from './item.types.d-BDFrq19E.js';
|
|
4
4
|
|
|
5
5
|
declare abstract class QtiVariableDeclaration extends LitElement {
|
|
6
6
|
render(): lit.TemplateResult<1>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as lit from 'lit';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
|
|
4
|
+
import { C as ComputedItemContext, V as View } from './session.context.d-Cjs0BkJB.js';
|
|
5
|
+
import { C as ConfigContext } from './config.context.d-BvU9r-Mg.js';
|
|
6
|
+
import { QtiAssessmentItem } from './elements.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `<item-container>` is a custom element designed for hosting the qti-assessment-item.
|
|
10
|
+
* The `qti-assessment-item` will be placed inside the shadow DOM of this element.
|
|
11
|
+
* The element loads the item from the provided URL and renders it inside the shadow DOM.
|
|
12
|
+
*
|
|
13
|
+
* ### Styling
|
|
14
|
+
* Add a class to the element for styling.
|
|
15
|
+
*
|
|
16
|
+
* ```html
|
|
17
|
+
* <qti-item>
|
|
18
|
+
* <item-container class="m-4 bg-white" item-url="./path/to/item.xml"></item-container>
|
|
19
|
+
* </qti-item>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare class ItemContainer extends LitElement {
|
|
23
|
+
#private;
|
|
24
|
+
/** Scoped registry used by the item shadow root. Must be set before connection. */
|
|
25
|
+
customElementRegistry: CustomElementRegistry | null;
|
|
26
|
+
/** URL of the item to load */
|
|
27
|
+
itemURL: string | null;
|
|
28
|
+
/** A parsed HTML document */
|
|
29
|
+
itemDoc: DocumentFragment | null;
|
|
30
|
+
/** The raw XML string */
|
|
31
|
+
itemXML: string | null;
|
|
32
|
+
protected qtiContext: QtiContext;
|
|
33
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
34
|
+
protected handleItemURLChange(): Promise<void>;
|
|
35
|
+
protected handleItemXMLChange(): void;
|
|
36
|
+
connectedCallback(): Promise<void>;
|
|
37
|
+
render(): lit.TemplateResult<1>;
|
|
38
|
+
}
|
|
39
|
+
declare global {
|
|
40
|
+
interface HTMLElementTagNameMap {
|
|
41
|
+
'item-container': ItemContainer;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare class ItemPrintVariables extends LitElement {
|
|
46
|
+
protected computedContext?: ComputedItemContext;
|
|
47
|
+
static styles: lit.CSSResult;
|
|
48
|
+
render(): lit.TemplateResult<1>;
|
|
49
|
+
}
|
|
50
|
+
declare global {
|
|
51
|
+
interface HTMLElementTagNameMap {
|
|
52
|
+
'item-print-variables': ItemPrintVariables;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare const QtiItem_base: (abstract new (...args: any[]) => {
|
|
57
|
+
view: View;
|
|
58
|
+
updateAssessmentItemView(assessmentItem: QtiAssessmentItem, view: View): void;
|
|
59
|
+
}) & typeof LitElement;
|
|
60
|
+
/**
|
|
61
|
+
* `<qti-item>` is a custom element designed for rendering a single `qti-assessment-item`.
|
|
62
|
+
* It can also host some functionalities to interact with the item like scoring, showing feedback, etc.
|
|
63
|
+
* Placing a mandatory `<item-container>` inside '<qti-item>' will load or parse the item and render it.
|
|
64
|
+
* See `<item-container>` for more details.
|
|
65
|
+
*
|
|
66
|
+
* ```html
|
|
67
|
+
* <qti-item>
|
|
68
|
+
* <item-container class="m-4 bg-white" item-url="./path/to/item.xml"></item-container>
|
|
69
|
+
* </qti-item>
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* `view` selects the audience the item is presented to, which is what reveals `view`-tagged
|
|
73
|
+
* content such as a scorer's `qti-rubric-block` — see `ItemViewMixin`.
|
|
74
|
+
*
|
|
75
|
+
* ```html
|
|
76
|
+
* <qti-item view="scorer">
|
|
77
|
+
* <item-container item-url="./path/to/item.xml"></item-container>
|
|
78
|
+
* </qti-item>
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
declare class QtiItem extends QtiItem_base {
|
|
82
|
+
#private;
|
|
83
|
+
computedContext: ComputedItemContext;
|
|
84
|
+
protected assessmentItem?: QtiAssessmentItem;
|
|
85
|
+
configContext: ConfigContext;
|
|
86
|
+
/**
|
|
87
|
+
* Provided so that descendants (e.g. `<item-container>`) can read the QTI runtime
|
|
88
|
+
* context for standalone item delivery, including the optional shuffle `seed`.
|
|
89
|
+
*/
|
|
90
|
+
qtiContext: QtiContext;
|
|
91
|
+
constructor();
|
|
92
|
+
render(): lit.TemplateResult<1>;
|
|
93
|
+
disconnectedCallback(): void;
|
|
94
|
+
}
|
|
95
|
+
declare global {
|
|
96
|
+
interface HTMLElementTagNameMap {
|
|
97
|
+
'qti-item': QtiItem;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { ItemContainer as I, QtiItem as Q, ItemPrintVariables as a };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Interface for any object that can process QTI rules
|
|
5
|
+
*/
|
|
6
|
+
interface QtiRuleBase {
|
|
7
|
+
process(): any;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Abstract base class for QTI rule DOM elements
|
|
11
|
+
*/
|
|
12
|
+
declare abstract class QtiRuleElement extends LitElement implements QtiRuleBase {
|
|
13
|
+
abstract process(): any;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Thrown by `qti-exit-response` to end the response processing of an attempt.
|
|
17
|
+
*
|
|
18
|
+
* An exit can sit at any depth — inside a `qti-response-condition` branch, or
|
|
19
|
+
* inside a `qti-response-processing-fragment` — and has to stop every rule
|
|
20
|
+
* after it, not just its own siblings. Unwinding the stack is what reaches
|
|
21
|
+
* every one of those loops without each of them having to report upwards.
|
|
22
|
+
*
|
|
23
|
+
* `qti-response-processing` catches it at the top of the run. The outcomes set
|
|
24
|
+
* before the exit are kept, because each `qti-set-outcome-value` has already
|
|
25
|
+
* dispatched by the time this is thrown.
|
|
26
|
+
*/
|
|
27
|
+
declare class QtiExitResponseSignal extends Error {
|
|
28
|
+
constructor();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Thrown by `qti-exit-test` to end the outcome processing of a test.
|
|
32
|
+
*
|
|
33
|
+
* The test-level twin of {@link QtiExitResponseSignal}, and unwinds the stack
|
|
34
|
+
* for the same reason: an exit inside a `qti-outcome-condition` branch has to
|
|
35
|
+
* stop the rules after the condition, not just its own siblings.
|
|
36
|
+
*/
|
|
37
|
+
declare class QtiExitTestSignal extends Error {
|
|
38
|
+
constructor();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { QtiExitResponseSignal as Q, QtiExitTestSignal as a, type QtiRuleBase as b, QtiRuleElement as c };
|
|
@@ -3,24 +3,52 @@ import { LitElement, PropertyValues, nothing } from 'lit';
|
|
|
3
3
|
import { t as transformItemApi, b as transformTestApi } from './qti-transform-test.d-BL7GGFJj.js';
|
|
4
4
|
import { QtiAssessmentItem, QtiModalFeedback } from './elements.js';
|
|
5
5
|
import { TemplateFunction } from '@heximal/templates';
|
|
6
|
-
import { T as TestContext, Q as QtiExpression, a as QtiExpressionBase } from './qti-expression.d-
|
|
7
|
-
import {
|
|
8
|
-
import { S as SessionContext,
|
|
6
|
+
import { T as TestContext, Q as QtiExpression, a as QtiExpressionBase } from './qti-expression.d-BksT9iLB.js';
|
|
7
|
+
import { h as VariableValue, c as OutcomeVariable, V as VariableDeclaration } from './item.types.d-BDFrq19E.js';
|
|
8
|
+
import { S as SessionContext, V as View } from './session.context.d-Cjs0BkJB.js';
|
|
9
9
|
import { C as ConfigContext } from './config.context.d-BvU9r-Mg.js';
|
|
10
|
-
import {
|
|
10
|
+
import { b as QtiRuleBase } from './qti-rule-base.d-Bdzg8eGH.js';
|
|
11
|
+
import { C as ComputedContext, a as ComputedItem } from './computed.types.d-DB5gfOh9.js';
|
|
11
12
|
import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
|
|
12
13
|
|
|
14
|
+
/**
|
|
15
|
+
* The model a `<template item-ref>` is rendered with.
|
|
16
|
+
*
|
|
17
|
+
* Only what this element already knows: the item's parsed document and the
|
|
18
|
+
* attributes off the item-ref itself. `itemRef` is the escape hatch — a
|
|
19
|
+
* template that needs anything else (a click handler, a value from the host
|
|
20
|
+
* app) reaches it through a property on the element, which the host is free to
|
|
21
|
+
* set.
|
|
22
|
+
*/
|
|
23
|
+
interface ItemRefTemplateModel {
|
|
24
|
+
/** The item's parsed document, i.e. what the element renders by default. */
|
|
25
|
+
xmlDoc: DocumentFragment;
|
|
26
|
+
identifier?: string;
|
|
27
|
+
href?: string;
|
|
28
|
+
category?: string;
|
|
29
|
+
/** The element being rendered. */
|
|
30
|
+
itemRef: QtiAssessmentItemRef;
|
|
31
|
+
}
|
|
13
32
|
declare class QtiAssessmentItemRef extends LitElement {
|
|
33
|
+
#private;
|
|
14
34
|
category?: string;
|
|
15
35
|
identifier?: string;
|
|
16
36
|
required?: boolean;
|
|
17
37
|
fixed?: boolean;
|
|
18
38
|
href?: string;
|
|
19
|
-
|
|
20
|
-
|
|
39
|
+
/**
|
|
40
|
+
* The `<qti-weight>` children of this ref, keyed by identifier — what
|
|
41
|
+
* `qti-test-variables`' `weight-identifier` resolves against.
|
|
42
|
+
*
|
|
43
|
+
* Read on access rather than cached: the test document is rendered into this
|
|
44
|
+
* element's light DOM, so the weights are not in place at construction time,
|
|
45
|
+
* and outcome processing runs long after they are.
|
|
46
|
+
*/
|
|
47
|
+
get weights(): Map<string, number>;
|
|
48
|
+
xmlDoc: DocumentFragment | null;
|
|
21
49
|
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
22
50
|
get assessmentItem(): QtiAssessmentItem | null;
|
|
23
|
-
myTemplate: TemplateFunction;
|
|
51
|
+
myTemplate: TemplateFunction | null;
|
|
24
52
|
connectedCallback(): Promise<void>;
|
|
25
53
|
render(): unknown;
|
|
26
54
|
}
|
|
@@ -87,6 +115,30 @@ declare global {
|
|
|
87
115
|
}
|
|
88
116
|
}
|
|
89
117
|
|
|
118
|
+
/**
|
|
119
|
+
* @summary The qti-number-selected expression counts the item refs selected for the test.
|
|
120
|
+
* @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.number-selected
|
|
121
|
+
*
|
|
122
|
+
* Outcome processing only. `section-identifier`, `include-category` and
|
|
123
|
+
* `exclude-category` narrow which item references are counted; with none of
|
|
124
|
+
* them it is every item reference in the test.
|
|
125
|
+
*
|
|
126
|
+
* The count comes from the item refs in the document rather than the test
|
|
127
|
+
* context, so it is the same set `qti-test-variables` aggregates over — and it
|
|
128
|
+
* is right before any item has been attempted.
|
|
129
|
+
*/
|
|
130
|
+
declare class QtiNumberSelected extends QtiExpression<number> {
|
|
131
|
+
#private;
|
|
132
|
+
constructor();
|
|
133
|
+
getResult(): number;
|
|
134
|
+
calculate(): number;
|
|
135
|
+
}
|
|
136
|
+
declare global {
|
|
137
|
+
interface HTMLElementTagNameMap {
|
|
138
|
+
'qti-number-selected': QtiNumberSelected;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
90
142
|
declare class QtiOutcomeProcessing extends LitElement {
|
|
91
143
|
static styles: lit.CSSResult[];
|
|
92
144
|
render(): lit.TemplateResult<1>;
|
|
@@ -484,7 +536,7 @@ declare class TestScoringButtons extends LitElement {
|
|
|
484
536
|
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
485
537
|
connectedCallback(): void;
|
|
486
538
|
protected computedContext?: ComputedContext;
|
|
487
|
-
render(): lit.TemplateResult<1
|
|
539
|
+
render(): typeof nothing | lit.TemplateResult<1>;
|
|
488
540
|
constructor();
|
|
489
541
|
}
|
|
490
542
|
declare global {
|
|
@@ -734,4 +786,4 @@ declare global {
|
|
|
734
786
|
}
|
|
735
787
|
}
|
|
736
788
|
|
|
737
|
-
export {
|
|
789
|
+
export { TestStamp as A, TestTtsNext as B, TestTtsPause as C, TestTtsPlay as D, TestTtsPrev as E, TestTtsResume as F, TestTtsStop as G, TestView as H, type ITestNavigationMixin as I, TestViewToggle as J, type TtsContext as K, ttsContext as L, QtiAssessmentItemRef as Q, type SpeechState as S, TestCheckItem as T, type ItemRefTemplateModel as a, QtiAssessmentSection as b, QtiAssessmentTest as c, QtiItemSessionControl as d, QtiNumberSelected as e, QtiOutcomeProcessing as f, QtiOutcomeProcessingProcessor as g, QtiTest as h, QtiTestFeedback as i, QtiTestPart as j, QtiTestVariables as k, QtiTestVariablesExpression as l, TestContainer as m, TestEndAttempt as n, TestItemLink as o, TestItemToSpeech as p, TestNavigation as q, TestNext as r, TestPagingButtonsStamp as s, TestPrev as t, TestPrintContext as u, TestPrintVariables as v, TestScoringButtons as w, TestScoringFeedback as x, TestSectionButtonsStamp as y, TestSectionLink as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement, CSSResultGroup, PropertyValues } from 'lit';
|
|
3
|
-
import { I as Interaction } from './interaction.d-
|
|
3
|
+
import { I as Interaction } from './interaction.d-DegNJ5ZA.js';
|
|
4
4
|
import { V as ValidatableInteraction } from './interaction.interface.d-CvjHM2bi.js';
|
|
5
5
|
import { C as ConfigContext } from './config.context.d-BvU9r-Mg.js';
|
|
6
|
-
import { B as BaseType, a as Cardinality,
|
|
6
|
+
import { B as BaseType, a as Cardinality, b as ItemContext, Q as QtiAreaMapEntry } from './item.types.d-BDFrq19E.js';
|
|
7
7
|
import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
|
|
8
8
|
import * as lit_directives_ref_js from 'lit/directives/ref.js';
|
|
9
9
|
|
|
@@ -86,14 +86,11 @@ declare class QtiGapImg extends LitElement {
|
|
|
86
86
|
tabindex: number | undefined;
|
|
87
87
|
/**
|
|
88
88
|
* `qti-gap-img` is a draggable chip, so it needs ElementInternals to carry the drag states
|
|
89
|
-
* (`dragging`, `placeholder`).
|
|
90
|
-
*
|
|
91
|
-
* NOTE: this element never calls `super.connectedCallback()`, so Lit never enables updating
|
|
92
|
-
* and it has no shadow root — which makes `qti-gap-img.styles.ts` dead code. Fixing that means
|
|
93
|
-
* adding a `<slot>` to a `render()` first, otherwise the authored `<img>` child disappears.
|
|
89
|
+
* (`dragging`, `placeholder`).
|
|
94
90
|
*/
|
|
95
91
|
internals: ElementInternals;
|
|
96
92
|
connectedCallback(): void;
|
|
93
|
+
render(): lit.TemplateResult<1>;
|
|
97
94
|
}
|
|
98
95
|
declare global {
|
|
99
96
|
interface HTMLElementTagNameMap {
|
|
@@ -765,7 +762,7 @@ declare global {
|
|
|
765
762
|
}
|
|
766
763
|
|
|
767
764
|
type HotspotChoice = Choice & {
|
|
768
|
-
order: number;
|
|
765
|
+
order: number | null;
|
|
769
766
|
};
|
|
770
767
|
declare const QtiGraphicOrderInteraction_base: (abstract new (...args: any[]) => ChoicesInterface) & typeof Interaction;
|
|
771
768
|
/**
|
|
@@ -779,9 +776,13 @@ declare const QtiGraphicOrderInteraction_base: (abstract new (...args: any[]) =>
|
|
|
779
776
|
declare class QtiGraphicOrderInteraction extends QtiGraphicOrderInteraction_base {
|
|
780
777
|
#private;
|
|
781
778
|
static styles: CSSResultGroup;
|
|
782
|
-
|
|
779
|
+
maxChoices: number;
|
|
783
780
|
protected _choiceElements: Choice[];
|
|
784
781
|
render(): lit.TemplateResult<1>;
|
|
782
|
+
protected _choiceElementSelectedHandler(event: CustomEvent<{
|
|
783
|
+
identifier: string;
|
|
784
|
+
}>): void;
|
|
785
|
+
protected handleOrderedResponseChange(): void;
|
|
785
786
|
/** Extension hook for packages that add semantic color states to locator pins. */
|
|
786
787
|
protected resolvePinColor(_choice: HotspotChoice): string;
|
|
787
788
|
protected refreshLocatorPins(): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { V as VariableDeclaration } from './item.types.d-BDFrq19E.js';
|
|
2
|
+
|
|
3
|
+
type ComputedItemContext = {
|
|
4
|
+
identifier: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
correct?: boolean;
|
|
7
|
+
incorrect?: boolean;
|
|
8
|
+
completed?: boolean;
|
|
9
|
+
adaptive?: boolean;
|
|
10
|
+
timeDependent?: boolean;
|
|
11
|
+
title?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
score?: number;
|
|
14
|
+
maxScore?: number;
|
|
15
|
+
completionStatus?: string;
|
|
16
|
+
variables: ReadonlyArray<VariableDeclaration<string | string[] | null>>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type View = 'author' | 'candidate' | 'proctor' | 'scorer' | 'testConstructor' | 'tutor' | '';
|
|
20
|
+
interface SessionContext {
|
|
21
|
+
navPartId?: string | null;
|
|
22
|
+
navSectionId?: string | null;
|
|
23
|
+
navItemRefId?: string | null;
|
|
24
|
+
navItemLoading?: boolean;
|
|
25
|
+
navTestLoading?: boolean;
|
|
26
|
+
view?: View;
|
|
27
|
+
}
|
|
28
|
+
declare const INITIAL_SESSION_CONTEXT: Readonly<SessionContext>;
|
|
29
|
+
declare const sessionContext: {
|
|
30
|
+
__context__: Readonly<SessionContext>;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { type ComputedItemContext as C, INITIAL_SESSION_CONTEXT as I, type SessionContext as S, type View as V, sessionContext as s };
|
package/dist/test.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { I as ITestNavigationMixin } from './qti-test.d-
|
|
2
|
-
export { Q as QtiAssessmentItemRef,
|
|
1
|
+
import { I as ITestNavigationMixin } from './qti-test.d-BfAZE6UF.js';
|
|
2
|
+
export { a as ItemRefTemplateModel, Q as QtiAssessmentItemRef, b as QtiAssessmentSection, c as QtiAssessmentTest, d as QtiItemSessionControl, e as QtiNumberSelected, f as QtiOutcomeProcessing, g as QtiOutcomeProcessingProcessor, h as QtiTest, i as QtiTestFeedback, j as QtiTestPart, k as QtiTestVariables, l as QtiTestVariablesExpression, S as SpeechState, T as TestCheckItem, m as TestContainer, n as TestEndAttempt, o as TestItemLink, p as TestItemToSpeech, q as TestNavigation, r as TestNext, s as TestPagingButtonsStamp, t as TestPrev, u as TestPrintContext, v as TestPrintVariables, w as TestScoringButtons, x as TestScoringFeedback, y as TestSectionButtonsStamp, z as TestSectionLink, A as TestStamp, B as TestTtsNext, C as TestTtsPause, D as TestTtsPlay, E as TestTtsPrev, F as TestTtsResume, G as TestTtsStop, H as TestView, J as TestViewToggle, K as TtsContext, L as ttsContext } from './qti-test.d-BfAZE6UF.js';
|
|
3
3
|
import { LitElement } from 'lit';
|
|
4
|
-
import {
|
|
5
|
-
import { S as SessionContext } from './
|
|
4
|
+
import { h as VariableValue, c as OutcomeVariable, V as VariableDeclaration } from './item.types.d-BDFrq19E.js';
|
|
5
|
+
import { S as SessionContext } from './session.context.d-Cjs0BkJB.js';
|
|
6
6
|
import { C as ConfigContext } from './config.context.d-BvU9r-Mg.js';
|
|
7
|
-
import { T as TestContext } from './qti-expression.d-
|
|
7
|
+
import { T as TestContext } from './qti-expression.d-BksT9iLB.js';
|
|
8
8
|
import './qti-transform-test.d-BL7GGFJj.js';
|
|
9
9
|
import './elements.js';
|
|
10
10
|
import './interaction.interface.d-CvjHM2bi.js';
|
|
11
|
-
import './qti-feedback.d-
|
|
12
|
-
import './qti-rule-base.d-
|
|
11
|
+
import './qti-feedback.d-D-w6-mJv.js';
|
|
12
|
+
import './qti-rule-base.d-Bdzg8eGH.js';
|
|
13
13
|
import '@heximal/templates';
|
|
14
|
+
import './computed.types.d-DB5gfOh9.js';
|
|
14
15
|
import './qti.context.d-CejJMlfZ.js';
|
|
15
|
-
import './computed-item.types.d-BKZdSLLJ.js';
|
|
16
16
|
|
|
17
17
|
interface IQtiTest extends LitElement, ITestNavigationMixin, ITestProcessingMixin, IMyQtiTest {
|
|
18
18
|
}
|
package/dist/test.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-ZOQVTG5L.js";
|
|
2
2
|
import {
|
|
3
3
|
QtiAssessmentItemRef,
|
|
4
4
|
QtiAssessmentSection,
|
|
5
5
|
QtiAssessmentTest,
|
|
6
6
|
QtiItemSessionControl,
|
|
7
|
+
QtiNumberSelected,
|
|
7
8
|
QtiOutcomeProcessing,
|
|
8
9
|
QtiOutcomeProcessingProcessor,
|
|
9
10
|
QtiTest,
|
|
@@ -36,17 +37,18 @@ import {
|
|
|
36
37
|
TestView,
|
|
37
38
|
TestViewToggle,
|
|
38
39
|
ttsContext
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
40
|
+
} from "./chunk-7PXUE2GR.js";
|
|
41
|
+
import "./chunk-REKCRWJV.js";
|
|
42
|
+
import "./chunk-A32YH4H5.js";
|
|
42
43
|
import "./chunk-4DB4SC5K.js";
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-TLAVOBEM.js";
|
|
45
|
+
import "./chunk-YVZWNLF4.js";
|
|
45
46
|
export {
|
|
46
47
|
QtiAssessmentItemRef,
|
|
47
48
|
QtiAssessmentSection,
|
|
48
49
|
QtiAssessmentTest,
|
|
49
50
|
QtiItemSessionControl,
|
|
51
|
+
QtiNumberSelected,
|
|
50
52
|
QtiOutcomeProcessing,
|
|
51
53
|
QtiOutcomeProcessingProcessor,
|
|
52
54
|
QtiTest,
|
package/dist/transformers.js
CHANGED
package/package.json
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citolab/qti-components",
|
|
3
3
|
"description": "QTI component utilities",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.2.0",
|
|
5
5
|
"author": "",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@heximal/templates": "^0.1.5",
|
|
8
8
|
"@lit/context": "^1.1.6",
|
|
9
|
-
"lit": "^3.3.
|
|
9
|
+
"lit": "^3.3.1",
|
|
10
|
+
"lit-html": "^3.3.1"
|
|
10
11
|
},
|
|
11
12
|
"devDependencies": {
|
|
12
|
-
"@qti-components/base": "^2.
|
|
13
|
-
"@qti-components/corrections": "^0.
|
|
14
|
-
"@qti-components/elements": "^1.
|
|
13
|
+
"@qti-components/base": "^2.3.0",
|
|
14
|
+
"@qti-components/corrections": "^0.4.0",
|
|
15
|
+
"@qti-components/elements": "^1.8.0",
|
|
15
16
|
"@qti-components/interactions": "^1.10.4",
|
|
16
|
-
"@qti-components/item": "^1.
|
|
17
|
+
"@qti-components/item": "^1.5.0",
|
|
17
18
|
"@qti-components/loader": "^1.3.3",
|
|
18
|
-
"@qti-components/processing": "^1.
|
|
19
|
-
"@qti-components/test": "^1.
|
|
20
|
-
"@qti-components/theme": "^2.1
|
|
21
|
-
"@qti-components/transformers": "^1.7.
|
|
19
|
+
"@qti-components/processing": "^1.6.0",
|
|
20
|
+
"@qti-components/test": "^1.7.0",
|
|
21
|
+
"@qti-components/theme": "^2.2.1",
|
|
22
|
+
"@qti-components/transformers": "^1.7.3"
|
|
22
23
|
},
|
|
23
24
|
"exports": {
|
|
24
25
|
".": {
|
|
@@ -92,9 +93,9 @@
|
|
|
92
93
|
"scripts": {
|
|
93
94
|
"-": "---build---",
|
|
94
95
|
"attw": "attw --pack --profile esm-only --format table",
|
|
95
|
-
"build": "run-s cem:react-types cem:react-types:patch-ref build:bundle",
|
|
96
|
+
"build": "pnpm run clean && run-s cem:react-types cem:react-types:patch-ref build:bundle",
|
|
96
97
|
"build:bundle": "run-p tsup css",
|
|
97
|
-
"cem:react-types": "
|
|
98
|
+
"cem:react-types": "pnpm -C ../.. run cem && node -e \"require('fs').writeFileSync('dist/qti-components-jsx.js','export {};\\n')\"",
|
|
98
99
|
"cem:react-types:patch-ref": "node ../../tools/build/patch-jsx-react-ref.mjs dist/qti-components-jsx.d.ts",
|
|
99
100
|
"clean": "rm -rf dist cdn",
|
|
100
101
|
"css": "postcss ../qti-theme/src/item.css -d dist -m",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../qti-item/src/components/item-container/item-container.ts","../../qti-item/src/components/item-print-variables/item-print-variables.ts","../../qti-item/src/components/qti-item/qti-item.ts","../../qti-item/src/elements.ts"],"sourcesContent":["import { consume } from '@lit/context';\nimport { LitElement, html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { until } from 'lit/directives/until.js';\n\nimport { qtiContext } from '@qti-components/base';\nimport { watch } from '@qti-components/utilities';\nimport { qtiTransformItem } from '@qti-components/transformers';\n\n// eslint-disable-next-line import/no-relative-packages\nimport itemCss from '../../../../qti-theme/src/item.css?inline';\n\nimport type { QtiContext } from '@qti-components/base';\n\n/**\n * `<item-container>` is a custom element designed for hosting the qti-assessment-item.\n * The `qti-assessment-item` will be placed inside the shadow DOM of this element.\n * The element loads the item from the provided URL and renders it inside the shadow DOM.\n *\n * ### Styling\n * Add a class to the element for styling.\n *\n * ```html\n * <qti-item>\n * <item-container class=\"m-4 bg-white\" item-url=\"./path/to/item.xml\"></item-container>\n * </qti-item>\n * ```\n */\n\nexport class ItemContainer extends LitElement {\n /** Scoped registry used by the item shadow root. Must be set before connection. */\n @property({ attribute: false })\n customElementRegistry: CustomElementRegistry | null = null;\n\n /** URL of the item to load */\n @property({ type: String, attribute: 'item-url' })\n itemURL: string | null = null;\n\n /** A parsed HTML document */\n @state()\n itemDoc: DocumentFragment | null = null;\n\n /** The raw XML string */\n @state()\n itemXML: string | null = null;\n\n @state()\n @consume({ context: qtiContext, subscribe: true })\n protected qtiContext: QtiContext = {\n QTI_CONTEXT: { testIdentifier: '', candidateIdentifier: '', environmentIdentifier: 'default' }\n };\n\n /** Template content if provided */\n #templateContent: unknown = null;\n #resolvedCustomElementRegistry: CustomElementRegistry | null = null;\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const registry = this.customElementRegistry;\n\n this.#resolvedCustomElementRegistry = registry;\n\n return (\n this.shadowRoot ??\n this.attachShadow({\n ...(this.constructor as typeof ItemContainer).shadowRootOptions,\n ...(registry ? { customElementRegistry: registry } : {})\n })\n );\n }\n\n @watch('itemURL', { waitUntilFirstUpdate: true })\n protected async handleItemURLChange() {\n if (!this.itemURL) return;\n try {\n const explicitSeed = this.qtiContext?.QTI_CONTEXT?.seed;\n const api = (await qtiTransformItem().load(this.itemURL)).shuffleInteractions(explicitSeed);\n this.itemDoc = api.htmlDoc(this.#resolvedCustomElementRegistry ?? undefined);\n } catch (error) {\n console.error('Error loading or parsing XML:', error);\n }\n }\n\n @watch('itemXML', { waitUntilFirstUpdate: true })\n protected handleItemXMLChange() {\n if (!this.itemXML) return;\n try {\n this.itemDoc = qtiTransformItem()\n .parse(this.itemXML)\n .htmlDoc(this.#resolvedCustomElementRegistry ?? undefined);\n } catch (error) {\n console.error('Error parsing XML:', error);\n }\n }\n\n override async connectedCallback(): Promise<void> {\n super.connectedCallback();\n this.#initializeTemplateContent();\n this.#applyStyles();\n if (this.itemURL) {\n this.handleItemURLChange();\n }\n if (this.itemXML) {\n this.handleItemXMLChange();\n }\n }\n\n #initializeTemplateContent() {\n const template = this.querySelector('template') as HTMLTemplateElement;\n this.#templateContent = template ? template.content : html``;\n }\n\n #applyStyles() {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(itemCss);\n this.shadowRoot.adoptedStyleSheets = [sheet];\n }\n\n override render() {\n return html`\n ${this.#templateContent}\n <slot></slot>\n ${until(this.itemDoc, html`<span>Loading...</span>`)}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-container': ItemContainer;\n }\n}\n","import { consume } from '@lit/context';\nimport { css, html, LitElement } from 'lit';\n\nimport { computedItemContext } from '@qti-components/base';\n\nimport type { ResponseVariable } from '@qti-components/base';\nimport type { ComputedItemContext } from '@qti-components/base';\n\nexport class ItemPrintVariables extends LitElement {\n @consume({ context: computedItemContext, subscribe: true })\n protected computedContext?: ComputedItemContext;\n\n static override styles = css`\n table {\n width: 100%;\n border-collapse: collapse;\n margin: 20px 0;\n font-size: 14px;\n text-align: left;\n }\n th,\n td {\n border: 1px solid #ddd;\n padding: 8px;\n }\n th {\n background-color: #f4f4f4;\n font-weight: bold;\n }\n h3 {\n margin-top: 20px;\n font-size: 16px;\n }\n `;\n\n override render() {\n const activeItem = this.computedContext;\n\n if (!activeItem || !activeItem.variables) return html``;\n\n const responseVariables: ResponseVariable[] = activeItem.variables.filter(v => v.type === 'response');\n const outcomeVariables = activeItem.variables.filter(v => v.type === 'outcome');\n\n const renderTable = (variables: ResponseVariable[], title: string) => html`\n <h3>${title}</h3>\n <table>\n <thead>\n <tr>\n <th>Identifier</th>\n <th>Value</th>\n <th>Cardinality</th>\n <th>Base Type</th>\n <th>Correct Response / Mappings</th>\n </tr>\n </thead>\n <tbody>\n ${variables.map(v => {\n const correctResponse = v.correctResponse\n ? Array.isArray(v.correctResponse)\n ? v.correctResponse.join(', ')\n : v.correctResponse\n : '';\n\n const mapEntries = v.mapping?.mapEntries?.map(m => `${m.mapKey}=${m.mappedValue}pt`).join(', ') || '';\n\n const areaMapEntries =\n v.areaMapping?.areaMapEntries?.map(m => `${m.shape}(${m.coords})=${m.mappedValue}pt`).join(', ') || '';\n\n return html`\n <tr>\n <td>${v.identifier}</td>\n <td>${Array.isArray(v.value) ? v.value.join(', ') : v.value}</td>\n <td>${v.cardinality}</td>\n <td>${v.baseType}</td>\n <td>${correctResponse || mapEntries || areaMapEntries}</td>\n </tr>\n `;\n })}\n </tbody>\n </table>\n `;\n\n return html`\n ${renderTable(responseVariables, 'Response Variables')} ${renderTable(outcomeVariables, 'Outcome Variables')}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-print-variables': ItemPrintVariables;\n }\n}\n","import { provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { state } from 'lit/decorators.js';\n\nimport { computedItemContext } from '@qti-components/base';\nimport { configContext } from '@qti-components/base';\nimport { qtiContext } from '@qti-components/base';\n\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { ConfigContext } from '@qti-components/base';\nimport type { QtiContext } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\nimport type { VariableDeclaration } from '@qti-components/base';\nimport type { ComputedItemContext } from '@qti-components/base';\n\n/**\n * `<qti-item>` is a custom element designed for rendering a single `qti-assessment-item`.\n * It can also host some functionalities to interact with the item like scoring, showing feedback, etc.\n * Placing a mandatory `<item-container>` inside '<qti-item>' will load or parse the item and render it.\n * See `<item-container>` for more details.\n *\n * ```html\n * <qti-item>\n * <item-container class=\"m-4 bg-white\" item-url=\"./path/to/item.xml\"></item-container>\n * </qti-item>\n * ```\n */\n\nexport class QtiItem extends LitElement {\n @state()\n @provide({ context: computedItemContext })\n public computedContext: ComputedItemContext;\n protected assessmentItem?: QtiAssessmentItem;\n\n @state()\n @provide({ context: configContext })\n public configContext: ConfigContext = {};\n\n /**\n * Provided so that descendants (e.g. `<item-container>`) can read the QTI runtime\n * context for standalone item delivery, including the optional shuffle `seed`.\n */\n @state()\n @provide({ context: qtiContext })\n public qtiContext: QtiContext = {\n QTI_CONTEXT: {\n testIdentifier: '',\n candidateIdentifier: '',\n environmentIdentifier: 'default'\n }\n };\n\n // Store event handlers as instance properties\n #onItemContextChanged = this.#handleItemContextChanged.bind(this);\n #onAssessmentItemConnected = this.#handleAssessmentItemConnected.bind(this);\n\n constructor() {\n super();\n this.addEventListener('qti-item-context-updated', this.#onItemContextChanged);\n this.addEventListener('qti-assessment-item-connected', this.#onAssessmentItemConnected);\n }\n\n #handleItemContextChanged(e: CustomEvent<{ itemContext: ItemContext }>) {\n this.#updateItemVariablesInTestContext(e.detail.itemContext.identifier, e.detail?.itemContext?.variables || []);\n }\n\n #handleAssessmentItemConnected(e: CustomEvent<QtiAssessmentItem>) {\n const fullVariables = (e.detail as any)._context.variables;\n this.assessmentItem = e.detail;\n this.computedContext =\n this.computedContext?.identifier === this.assessmentItem.identifier\n ? { ...this.computedContext, title: this.assessmentItem.title }\n : ({\n identifier: this.assessmentItem.identifier,\n title: this.assessmentItem.title,\n adaptive: this.assessmentItem.getAttribute('adaptive')?.toLowerCase() === 'true' || false,\n variables: fullVariables\n } as ComputedItemContext);\n this.#updateItemVariablesInTestContext(this.assessmentItem.identifier, fullVariables || []);\n }\n\n #updateItemVariablesInTestContext(\n identifier: string,\n variables: readonly VariableDeclaration<string | string[] | null>[]\n ): void {\n const rawscore = variables?.find(vr => vr.identifier == 'SCORE')?.value;\n const score = parseFloat(rawscore?.toString());\n const completionStatus = variables?.find(v => v.identifier === 'completionStatus')?.value;\n\n const correct = score !== undefined && !isNaN(score) && score > 0;\n const incorrect = score !== undefined && !isNaN(score) && score <= 0;\n const completed = completionStatus === 'completed';\n this.computedContext = {\n ...this.computedContext,\n identifier,\n correct,\n incorrect,\n completed,\n variables\n };\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('qti-item-context-changed', this.#onItemContextChanged);\n this.removeEventListener('qti-assessment-item-connected', this.#onAssessmentItemConnected);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-item': QtiItem;\n }\n}\n","import { ItemContainer } from './components/item-container/item-container';\nimport { ItemPrintVariables } from './components/item-print-variables/item-print-variables';\nimport { QtiItem } from './components/qti-item/qti-item';\n\nexport { ItemContainer, ItemPrintVariables, QtiItem };\n\nexport const qtiItemElements = [\n { tag: 'item-container', ctor: ItemContainer },\n { tag: 'item-print-variables', ctor: ItemPrintVariables },\n { tag: 'qti-item', ctor: QtiItem }\n] as const;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,YAAY,YAAY;AACjC,SAAS,UAAU,aAAa;AAChC,SAAS,aAAa;;;;;;;AA0BhB,IAAO,gBAAP,cAA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,GAAG,KAAK,iBAAiB,OAAO,KAAK,eAAe,MAAK,IAC1D;MACC,YAAY,KAAK,eAAe;MAChC,OAAO,KAAK,eAAe;MAC3B,UAAU,KAAK,eAAe,aAAa,UAAU,GAAG,YAAW,MAAO,UAAU;MACpF,WAAW;;AAEnB,SAAK,kCAAkC,KAAK,eAAe,YAAY,iBAAiB,CAAA,CAAE;EAC5F;EAEA,kCACE,YACA,WAAmE;AAEnE,UAAM,WAAW,WAAW,KAAK,QAAM,GAAG,cAAc,OAAO,GAAG;AAClE,UAAM,QAAQ,WAAW,UAAU,SAAQ,CAAE;AAC7C,UAAM,mBAAmB,WAAW,KAAK,OAAK,EAAE,eAAe,kBAAkB,GAAG;AAEpF,UAAM,UAAU,UAAU,UAAa,CAAC,MAAM,KAAK,KAAK,QAAQ;AAChE,UAAM,YAAY,UAAU,UAAa,CAAC,MAAM,KAAK,KAAK,SAAS;AACnE,UAAM,YAAY,qBAAqB;AACvC,SAAK,kBAAkB;MACrB,GAAG,KAAK;MACR;MACA;MACA;MACA;MACA;;EAEJ;EAES,SAAM;AACb,WAAOC;EACT;EAES,uBAAoB;AAC3B,UAAM,qBAAoB;AAC1B,SAAK,oBAAoB,4BAA4B,KAAK,qBAAqB;AAC/E,SAAK,oBAAoB,iCAAiC,KAAK,0BAA0B;EAC3F;;AA/EOC,YAAA;EAFNC,OAAK;EACL,QAAQ,EAAE,SAAS,oBAAmB,CAAE;;AAMlCD,YAAA;EAFNC,OAAK;EACL,QAAQ,EAAE,SAAS,cAAa,CAAE;;AAS5BD,YAAA;EAFNC,OAAK;EACL,QAAQ,EAAE,SAAS,WAAU,CAAE;;;;ACrC3B,IAAM,kBAAkB;EAC7B,EAAE,KAAK,kBAAkB,MAAM,cAAa;EAC5C,EAAE,KAAK,wBAAwB,MAAM,mBAAkB;EACvD,EAAE,KAAK,YAAY,MAAM,QAAO;;","names":["consume","html","LitElement","LitElement","html","__decorate","consume","html","LitElement","state","LitElement","html","__decorate","state"]}
|