@qti-components/elements 1.6.2 → 1.6.4
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/dist/components/qti-assessment-item/qti-assessment-item.d.ts +13 -10
- package/dist/components/qti-assessment-item/qti-assessment-item.js +107 -49
- package/dist/components/qti-assessment-item/qti-assessment-item.js.map +1 -1
- package/dist/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.js +3 -7
- package/dist/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.js.map +1 -1
- package/dist/components/qti-companion-materials-info/qti-companion-materials-info.js +2 -13
- package/dist/components/qti-companion-materials-info/qti-companion-materials-info.js.map +1 -1
- package/dist/components/qti-content-body/qti-content-body.d.ts +5 -0
- package/dist/components/qti-content-body/qti-content-body.js +58 -8
- package/dist/components/qti-content-body/qti-content-body.js.map +1 -1
- package/dist/components/qti-context-declaration/qti-context-declaration.js +3 -7
- package/dist/components/qti-context-declaration/qti-context-declaration.js.map +1 -1
- package/dist/components/qti-custom-operator/qti-custom-operator.js +3 -7
- package/dist/components/qti-custom-operator/qti-custom-operator.js.map +1 -1
- package/dist/components/qti-feedback-block/qti-feedback-block.js +2 -13
- package/dist/components/qti-feedback-block/qti-feedback-block.js.map +1 -1
- package/dist/components/qti-feedback-inline/qti-feedback-inline.js +2 -13
- package/dist/components/qti-feedback-inline/qti-feedback-inline.js.map +1 -1
- package/dist/components/qti-item-body/qti-item-body.js +2 -13
- package/dist/components/qti-item-body/qti-item-body.js.map +1 -1
- package/dist/components/qti-modal-feedback/qti-modal-feedback.js +12 -24
- package/dist/components/qti-modal-feedback/qti-modal-feedback.js.map +1 -1
- package/dist/components/qti-outcome-declaration/qti-outcome-declaration.js +3 -7
- package/dist/components/qti-outcome-declaration/qti-outcome-declaration.js.map +1 -1
- package/dist/components/qti-response-declaration/qti-response-declaration.js +3 -7
- package/dist/components/qti-response-declaration/qti-response-declaration.js.map +1 -1
- package/dist/components/qti-response-processing/qti-response-processing.js +2 -13
- package/dist/components/qti-response-processing/qti-response-processing.js.map +1 -1
- package/dist/components/qti-rubric-block/qti-rubric-block.js +3 -7
- package/dist/components/qti-rubric-block/qti-rubric-block.js.map +1 -1
- package/dist/components/qti-stylesheet/qti-stylesheet.js +2 -13
- package/dist/components/qti-stylesheet/qti-stylesheet.js.map +1 -1
- package/dist/components/qti-template-constraint/qti-template-constraint.js +2 -13
- package/dist/components/qti-template-constraint/qti-template-constraint.js.map +1 -1
- package/dist/components/qti-template-declaration/qti-template-declaration.js +3 -7
- package/dist/components/qti-template-declaration/qti-template-declaration.js.map +1 -1
- package/dist/components/qti-template-processing/qti-template-processing.js +2 -13
- package/dist/components/qti-template-processing/qti-template-processing.js.map +1 -1
- package/dist/elements.d.ts +74 -0
- package/dist/elements.js +40 -0
- package/dist/elements.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/register.d.ts +1 -0
- package/dist/register.js +7 -0
- package/dist/register.js.map +1 -0
- package/package.json +22 -5
|
@@ -4,15 +4,65 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
+
import { consume } from '@lit/context';
|
|
7
8
|
import { LitElement, html } from 'lit';
|
|
8
|
-
import {
|
|
9
|
-
|
|
9
|
+
import { state } from 'lit/decorators.js';
|
|
10
|
+
import { itemContext } from '@qti-components/base';
|
|
11
|
+
export class QtiContentBody extends LitElement {
|
|
10
12
|
render() {
|
|
11
|
-
return html `<slot></slot>`;
|
|
13
|
+
return html `<slot @slotchange=${this.#expandMathVariables}></slot>`;
|
|
12
14
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
super.connectedCallback();
|
|
17
|
+
this.updateComplete.then(() => this.#expandMathVariables());
|
|
18
|
+
}
|
|
19
|
+
updated(changedProperties) {
|
|
20
|
+
if (changedProperties.has('context')) {
|
|
21
|
+
this.#expandMathVariables();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
#expandMathVariables() {
|
|
25
|
+
const mathVariables = new Map();
|
|
26
|
+
const templateVariables = (this.context?.variables ?? []).filter(variable => variable.type === 'template');
|
|
27
|
+
for (const variable of templateVariables) {
|
|
28
|
+
const templateVariable = variable;
|
|
29
|
+
if (templateVariable.mathVariable !== true ||
|
|
30
|
+
templateVariable.value === null ||
|
|
31
|
+
templateVariable.value === undefined) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
mathVariables.set(templateVariable.identifier, this.#stringifyValue(templateVariable.value));
|
|
35
|
+
}
|
|
36
|
+
if (mathVariables.size === 0) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const mathIdentifiers = Array.from(this.querySelectorAll('*')).filter(element => element.localName.toLowerCase() === 'mi' || element.localName.toLowerCase() === 'mn');
|
|
40
|
+
for (const element of mathIdentifiers) {
|
|
41
|
+
const identifier = element.getAttribute('data-qti-math-variable-source') ?? element.textContent?.trim() ?? '';
|
|
42
|
+
const value = mathVariables.get(identifier);
|
|
43
|
+
if (!value) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (element.localName.toLowerCase() === 'mn') {
|
|
47
|
+
element.textContent = value;
|
|
48
|
+
element.setAttribute('data-qti-math-variable-source', identifier);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const replacement = document.createElement('mn');
|
|
52
|
+
replacement.textContent = value;
|
|
53
|
+
replacement.setAttribute('data-qti-math-variable-source', identifier);
|
|
54
|
+
element.replaceWith(replacement);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
#stringifyValue(value) {
|
|
58
|
+
if (Array.isArray(value)) {
|
|
59
|
+
return value.join(' ');
|
|
60
|
+
}
|
|
61
|
+
return value?.toString() ?? '';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
__decorate([
|
|
65
|
+
consume({ context: itemContext, subscribe: true }),
|
|
66
|
+
state()
|
|
67
|
+
], QtiContentBody.prototype, "context", void 0);
|
|
18
68
|
//# sourceMappingURL=qti-content-body.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-content-body.js","sourceRoot":"","sources":["../../../src/components/qti-content-body/qti-content-body.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"qti-content-body.js","sourceRoot":"","sources":["../../../src/components/qti-content-body/qti-content-body.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInD,MAAM,OAAO,cAAe,SAAQ,UAAU;IAKnC,MAAM;QACb,OAAO,IAAI,CAAA,qBAAqB,IAAI,CAAC,oBAAoB,UAAU,CAAC;IACtE,CAAC;IAEe,iBAAiB;QAC/B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAC9D,CAAC;IAEkB,OAAO,CAAC,iBAAyD;QAClF,IAAI,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,oBAAo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AI,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,KAAK,IAAI,EAAE,CAAC;gBAC7C,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC;gBAC5B,OAAO,CAAC,YAAY,CAAC,+BAA+B,EAAE,UAAU,CAAC,CAAC;gBAClE,SAAS;YACX,CAAC;YAED,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACjD,WAAW,CAAC,WAAW,GAAG,KAAK,CAAC;YAChC,WAAW,CAAC,YAAY,CAAC,+BAA+B,EAAE,UAAU,CAAC,CAAC;YACtE,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,eAAe,CAAC,KAA2D;QACzE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QAED,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACjC,CAAC;CACF;AAtEW;IAFT,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAClD,KAAK,EAAE;+CACwB","sourcesContent":["import { consume } from '@lit/context';\nimport { LitElement, html } from 'lit';\nimport { state } from 'lit/decorators.js';\n\nimport { itemContext } from '@qti-components/base';\n\nimport type { ItemContext, TemplateVariable } from '@qti-components/base';\n\nexport class QtiContentBody extends LitElement {\n @consume({ context: itemContext, subscribe: true })\n @state()\n protected context?: ItemContext;\n\n override render() {\n return html`<slot @slotchange=${this.#expandMathVariables}></slot>`;\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.updateComplete.then(() => this.#expandMathVariables());\n }\n\n protected override updated(changedProperties: Map<string | number | symbol, unknown>): void {\n if (changedProperties.has('context')) {\n this.#expandMathVariables();\n }\n }\n\n #expandMathVariables(): void {\n const mathVariables = new Map<string, string>();\n const templateVariables = (this.context?.variables ?? []).filter(variable => variable.type === 'template');\n\n for (const variable of templateVariables) {\n const templateVariable = variable as TemplateVariable;\n if (\n templateVariable.mathVariable !== true ||\n templateVariable.value === null ||\n templateVariable.value === undefined\n ) {\n continue;\n }\n\n mathVariables.set(templateVariable.identifier, this.#stringifyValue(templateVariable.value));\n }\n\n if (mathVariables.size === 0) {\n return;\n }\n\n const mathIdentifiers = Array.from(this.querySelectorAll('*')).filter(\n element => element.localName.toLowerCase() === 'mi' || element.localName.toLowerCase() === 'mn'\n );\n\n for (const element of mathIdentifiers) {\n const identifier = element.getAttribute('data-qti-math-variable-source') ?? element.textContent?.trim() ?? '';\n const value = mathVariables.get(identifier);\n\n if (!value) {\n continue;\n }\n\n if (element.localName.toLowerCase() === 'mn') {\n element.textContent = value;\n element.setAttribute('data-qti-math-variable-source', identifier);\n continue;\n }\n\n const replacement = document.createElement('mn');\n replacement.textContent = value;\n replacement.setAttribute('data-qti-math-variable-source', identifier);\n element.replaceWith(replacement);\n }\n }\n\n #stringifyValue(value: string | readonly string[] | number | boolean | null): string {\n if (Array.isArray(value)) {\n return value.join(' ');\n }\n\n return value?.toString() ?? '';\n }\n}\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-content-body': QtiContentBody;\n }\n}\n"]}
|
|
@@ -5,12 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { css, LitElement, html } from 'lit';
|
|
8
|
-
import {
|
|
8
|
+
import { property } from 'lit/decorators.js';
|
|
9
9
|
/**
|
|
10
10
|
* @summary The qti-context-declaration element declares context variables for an item.
|
|
11
11
|
* @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.qti-context-declaration
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
export class QtiContextDeclaration extends LitElement {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
16
|
this.identifier = '';
|
|
@@ -26,15 +26,11 @@ let QtiContextDeclaration = class QtiContextDeclaration extends LitElement {
|
|
|
26
26
|
render() {
|
|
27
27
|
return html `<slot></slot>`;
|
|
28
28
|
}
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
30
|
__decorate([
|
|
31
31
|
property({ type: String })
|
|
32
32
|
], QtiContextDeclaration.prototype, "identifier", void 0);
|
|
33
33
|
__decorate([
|
|
34
34
|
property({ type: String })
|
|
35
35
|
], QtiContextDeclaration.prototype, "cardinality", void 0);
|
|
36
|
-
QtiContextDeclaration = __decorate([
|
|
37
|
-
customElement('qti-context-declaration')
|
|
38
|
-
], QtiContextDeclaration);
|
|
39
|
-
export { QtiContextDeclaration };
|
|
40
36
|
//# sourceMappingURL=qti-context-declaration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-context-declaration.js","sourceRoot":"","sources":["../../../src/components/qti-context-declaration/qti-context-declaration.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"qti-context-declaration.js","sourceRoot":"","sources":["../../../src/components/qti-context-declaration/qti-context-declaration.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;GAGG;AAEH,MAAM,OAAO,qBAAsB,SAAQ,UAAU;IAArD;;QAC8B,eAAU,GAAW,EAAE,CAAC;QACxB,gBAAW,GAAiD,QAAQ,CAAC;IAanG,CAAC;aAXiB,WAAM,GAAG;QACvB,GAAG,CAAA;;;;KAIF;KACF,AANqB,CAMpB;IAEO,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AAb2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAAsE","sourcesContent":["import { css, LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\n\n/**\n * @summary The qti-context-declaration element declares context variables for an item.\n * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.qti-context-declaration\n */\n\nexport class QtiContextDeclaration extends LitElement {\n @property({ type: String }) identifier: string = '';\n @property({ type: String }) cardinality: 'single' | 'multiple' | 'ordered' | 'record' = 'record';\n\n static override styles = [\n css`\n :host {\n display: none;\n }\n `\n ];\n\n override render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-context-declaration': QtiContextDeclaration;\n }\n}\n"]}
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { consume } from '@lit/context';
|
|
8
8
|
import { LitElement, html } from 'lit';
|
|
9
|
-
import {
|
|
9
|
+
import { state } from 'lit/decorators.js';
|
|
10
10
|
import { itemContext } from '@qti-components/base';
|
|
11
11
|
/**
|
|
12
12
|
* https://www.imsglobal.org/spec/qti/v3p0/impl#h.fi29q8dubjgw
|
|
@@ -19,7 +19,7 @@ import { itemContext } from '@qti-components/base';
|
|
|
19
19
|
</qti-custom-operator>
|
|
20
20
|
</qti-set-outcome-value>
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
export class QtiCustomOperator extends LitElement {
|
|
23
23
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
24
24
|
#operatorFunction;
|
|
25
25
|
render() {
|
|
@@ -66,13 +66,9 @@ let QtiCustomOperator = class QtiCustomOperator extends LitElement {
|
|
|
66
66
|
};
|
|
67
67
|
return this.#operatorFunction(this._context, fn, item);
|
|
68
68
|
}
|
|
69
|
-
}
|
|
69
|
+
}
|
|
70
70
|
__decorate([
|
|
71
71
|
consume({ context: itemContext, subscribe: true }),
|
|
72
72
|
state()
|
|
73
73
|
], QtiCustomOperator.prototype, "_context", void 0);
|
|
74
|
-
QtiCustomOperator = __decorate([
|
|
75
|
-
customElement('qti-custom-operator')
|
|
76
|
-
], QtiCustomOperator);
|
|
77
|
-
export { QtiCustomOperator };
|
|
78
74
|
//# sourceMappingURL=qti-custom-operator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-custom-operator.js","sourceRoot":"","sources":["../../../src/components/qti-custom-operator/qti-custom-operator.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"qti-custom-operator.js","sourceRoot":"","sources":["../../../src/components/qti-custom-operator/qti-custom-operator.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAMnD;;;;;;;;;;GAUG;AAEH,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAC/C,sEAAsE;IACtE,iBAAiB,CAAW;IAMnB,MAAM;QACb,OAAO,IAAI,CAAA,qBAAqB,IAAI,CAAC,gBAAgB,UAAU,CAAC;IAClE,CAAC;IAED,gBAAgB;QACd,gGAAgG;QAChG,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,CAC3E,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY,CA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I,CAAC,aAAa,CAChB,IAAI,WAAW,CAA8D,0BAA0B,EAAE;oBACvG,OAAO,EAAE,IAAI;oBACb,QAAQ,EAAE,IAAI;oBACd,MAAM,EAAE;wBACN,kBAAkB;wBAClB,QAAQ;qBACT;iBACF,CAAC,CACH,CAAC;YACJ,CAAC;SACF,CAAC;QAEF,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;CACF;AAzDS;IAFP,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAClD,KAAK,EAAE;mDACuB","sourcesContent":["import { consume } from '@lit/context';\nimport { LitElement, html } from 'lit';\nimport { state } from 'lit/decorators.js';\n\nimport { itemContext } from '@qti-components/base';\n\nimport type { ResponseVariable } from '@qti-components/base';\nimport type { Calculate } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\n\n/**\n * https://www.imsglobal.org/spec/qti/v3p0/impl#h.fi29q8dubjgw\n * <qti-custom-operator class=\"js.org\">\n <qti-base-value base-type=\"string\"><![CDATA[\n console.log(context.variables);\n return 'B'\n document.querySelector('qti-end-attempt-interaction').disabled = true;\n ]]></qti-base-value>\n </qti-custom-operator>\n </qti-set-outcome-value>\n */\n\nexport class QtiCustomOperator extends LitElement implements Calculate {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n #operatorFunction: Function;\n\n @consume({ context: itemContext, subscribe: true })\n @state()\n private _context?: ItemContext;\n\n override render() {\n return html`<slot @slotchange=${this.handleSlotChange}></slot>`;\n }\n\n handleSlotChange() {\n // expecting <[!CDATA[ ... ]]> is converted into <!-- ... --> with qti-transform: cDataToComment\n const commentNode = Array.from(this.firstElementChild?.childNodes ?? []).find(\n node => node.nodeType === Node.COMMENT_NODE\n );\n try {\n this.#operatorFunction = new Function('context', 'fn', 'item', commentNode?.textContent ?? '');\n } catch (e) {\n console.error('custom-operator contains invalid javascript code', e);\n }\n }\n\n public calculate() {\n const fn = {\n variable: (responseIdentifier: string) =>\n this._context?.variables.find(v => v.identifier === responseIdentifier)?.value ?? '',\n correct: (responseIdentifier: string) =>\n (this._context?.variables.find(v => v.identifier === responseIdentifier) as ResponseVariable)\n ?.correctResponse ?? ''\n };\n const item = {\n getVariable: (variableIdentifier: string) =>\n this._context?.variables.find(v => v.identifier === variableIdentifier),\n updateOutcomeVariable: (outcomeIdentifier: string, value: string | string[]) => {\n this.dispatchEvent(\n new CustomEvent<{ outcomeIdentifier: string; value: string | string[] }>('qti-set-outcome-value', {\n bubbles: true,\n composed: true,\n detail: {\n outcomeIdentifier,\n value\n }\n })\n );\n },\n updateResponseVariable: (responseIdentifier: string, response: string | string[]) => {\n this.dispatchEvent(\n new CustomEvent<{ responseIdentifier: string; response: string | string[] }>('qti-interaction-response', {\n bubbles: true,\n composed: true,\n detail: {\n responseIdentifier,\n response\n }\n })\n );\n }\n };\n\n return this.#operatorFunction(this._context, fn, item);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-custom-operator': QtiCustomOperator;\n }\n}\n"]}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
1
|
import { css, html } from 'lit';
|
|
8
|
-
import { customElement } from 'lit/decorators.js';
|
|
9
2
|
import { QtiFeedback } from '@qti-components/base';
|
|
10
|
-
|
|
3
|
+
export class QtiFeedbackBlock extends QtiFeedback {
|
|
11
4
|
static { this.styles = css `
|
|
12
5
|
:host {
|
|
13
6
|
display: block;
|
|
@@ -26,9 +19,5 @@ let QtiFeedbackBlock = class QtiFeedbackBlock extends QtiFeedback {
|
|
|
26
19
|
super.connectedCallback();
|
|
27
20
|
this.checkShowFeedback(this.outcomeIdentifier);
|
|
28
21
|
}
|
|
29
|
-
}
|
|
30
|
-
QtiFeedbackBlock = __decorate([
|
|
31
|
-
customElement('qti-feedback-block')
|
|
32
|
-
], QtiFeedbackBlock);
|
|
33
|
-
export { QtiFeedbackBlock };
|
|
22
|
+
}
|
|
34
23
|
//# sourceMappingURL=qti-feedback-block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-feedback-block.js","sourceRoot":"","sources":["../../../src/components/qti-feedback-block/qti-feedback-block.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"qti-feedback-block.js","sourceRoot":"","sources":["../../../src/components/qti-feedback-block/qti-feedback-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,OAAO,gBAAiB,SAAQ,WAAW;aAC/B,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;GAU3B,CAAC;IAEO,MAAM;QACb,OAAO,IAAI,CAAA,0CAA0C,IAAI,CAAC,UAAU,YAAY,CAAC;IACnF,CAAC;IAEe,iBAAiB;QAC/B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACjD,CAAC","sourcesContent":["import { css, html } from 'lit';\n\nimport { QtiFeedback } from '@qti-components/base';\n\nexport class QtiFeedbackBlock extends QtiFeedback {\n static override styles = css`\n :host {\n display: block;\n }\n .on {\n display: block;\n }\n .off {\n display: none;\n }\n `;\n\n override render() {\n return html` <slot part=\"feedback\" class=\"feedback ${this.showStatus}\"></slot> `;\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.checkShowFeedback(this.outcomeIdentifier);\n }\n}\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-feedback-block': QtiFeedbackBlock;\n }\n}\n"]}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
1
|
import { css, html } from 'lit';
|
|
8
|
-
import { customElement } from 'lit/decorators.js';
|
|
9
2
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
10
3
|
import { QtiFeedback } from '@qti-components/base';
|
|
11
|
-
|
|
4
|
+
export class QtiFeedbackInline extends QtiFeedback {
|
|
12
5
|
constructor() {
|
|
13
6
|
super(...arguments);
|
|
14
7
|
this.render = () => html ` <slot part="feedback" class="${ifDefined(this.showStatus)}"></slot> `;
|
|
@@ -25,9 +18,5 @@ let QtiFeedbackInline = class QtiFeedbackInline extends QtiFeedback {
|
|
|
25
18
|
super.connectedCallback();
|
|
26
19
|
this.checkShowFeedback(this.outcomeIdentifier);
|
|
27
20
|
}
|
|
28
|
-
}
|
|
29
|
-
QtiFeedbackInline = __decorate([
|
|
30
|
-
customElement('qti-feedback-inline')
|
|
31
|
-
], QtiFeedbackInline);
|
|
32
|
-
export { QtiFeedbackInline };
|
|
21
|
+
}
|
|
33
22
|
//# sourceMappingURL=qti-feedback-inline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-feedback-inline.js","sourceRoot":"","sources":["../../../src/components/qti-feedback-inline/qti-feedback-inline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"qti-feedback-inline.js","sourceRoot":"","sources":["../../../src/components/qti-feedback-inline/qti-feedback-inline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAAlD;;QAUW,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA,iCAAiC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;IAMtG,CAAC;aAfiB,WAAM,GAAG,GAAG,CAAA;;;;;;;GAO3B,AAPqB,CAOpB;IAIc,iBAAiB;QAC/B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACjD,CAAC","sourcesContent":["import { css, html } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport { QtiFeedback } from '@qti-components/base';\n\nexport class QtiFeedbackInline extends QtiFeedback {\n static override styles = css`\n .on {\n display: inline-block;\n }\n .off {\n display: none;\n }\n `;\n\n override render = () => html` <slot part=\"feedback\" class=\"${ifDefined(this.showStatus)}\"></slot> `;\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.checkShowFeedback(this.outcomeIdentifier);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-feedback-inline': QtiFeedbackInline;\n }\n}\n"]}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { customElement } from 'lit/decorators.js';
|
|
8
1
|
import { html, LitElement } from 'lit';
|
|
9
2
|
import styles from './qti-item-body.styles';
|
|
10
3
|
/**
|
|
@@ -17,14 +10,10 @@ import styles from './qti-item-body.styles';
|
|
|
17
10
|
* @slot qti-rubric-block - the qti rubric block is placed above the item
|
|
18
11
|
* @part qti-rubric-block - the qti rubric block part
|
|
19
12
|
*/
|
|
20
|
-
|
|
13
|
+
export class QtiItemBody extends LitElement {
|
|
21
14
|
static { this.styles = styles; }
|
|
22
15
|
render() {
|
|
23
16
|
return html `<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`;
|
|
24
17
|
}
|
|
25
|
-
}
|
|
26
|
-
QtiItemBody = __decorate([
|
|
27
|
-
customElement('qti-item-body')
|
|
28
|
-
], QtiItemBody);
|
|
29
|
-
export { QtiItemBody };
|
|
18
|
+
}
|
|
30
19
|
//# sourceMappingURL=qti-item-body.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-item-body.js","sourceRoot":"","sources":["../../../src/components/qti-item-body/qti-item-body.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"qti-item-body.js","sourceRoot":"","sources":["../../../src/components/qti-item-body/qti-item-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEvC,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAI5C;;;;;;;;;GASG;AAEH,MAAM,OAAO,WAAY,SAAQ,UAAU;aACzB,WAAM,GAAmB,MAAM,CAAC;IAEvC,MAAM;QACb,OAAO,IAAI,CAAA,6EAA6E,CAAC;IAC3F,CAAC","sourcesContent":["import { html, LitElement } from 'lit';\n\nimport styles from './qti-item-body.styles';\n\nimport type { CSSResultGroup } from 'lit';\n\n/**\n * @summary The qti-item-body node contains the text, graphics, media objects and interactions that describe the item's content and information about how it is structured.\n * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.sphpo6lu6zqi\n * @status stable\n * @since 4.0\n *\n * @slot - item body content.\n * @slot qti-rubric-block - the qti rubric block is placed above the item\n * @part qti-rubric-block - the qti rubric block part\n */\n\nexport class QtiItemBody extends LitElement {\n static override styles: CSSResultGroup = styles;\n\n override render() {\n return html`<slot part=\"qti-rubric-blocks\" name=\"qti-rubric-block\"></slot><slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-item-body': QtiItemBody;\n }\n}\n"]}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
1
|
import { css, html } from 'lit';
|
|
8
|
-
import { customElement } from 'lit/decorators.js';
|
|
9
2
|
import { QtiFeedback } from '@qti-components/base';
|
|
10
|
-
|
|
3
|
+
export class QtiModalFeedback extends QtiFeedback {
|
|
11
4
|
static { this.styles = css `
|
|
12
|
-
.
|
|
5
|
+
.cito-dialog {
|
|
13
6
|
background: var(--qti-bg);
|
|
14
7
|
border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
|
|
15
8
|
border-radius: var(--qti-border-radius);
|
|
16
|
-
padding: var(--qti-padding-
|
|
9
|
+
padding: var(--qti-padding-box);
|
|
17
10
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
18
11
|
position: fixed;
|
|
19
12
|
top: 50%;
|
|
@@ -26,7 +19,7 @@ let QtiModalFeedback = class QtiModalFeedback extends QtiFeedback {
|
|
|
26
19
|
|
|
27
20
|
.button {
|
|
28
21
|
border-radius: var(--qti-border-radius);
|
|
29
|
-
padding: var(--qti-padding-
|
|
22
|
+
padding: var(--qti-padding-box);
|
|
30
23
|
background-color: var(--qti-bg-active);
|
|
31
24
|
border: var(--qti-border-active);
|
|
32
25
|
cursor: pointer;
|
|
@@ -34,13 +27,12 @@ let QtiModalFeedback = class QtiModalFeedback extends QtiFeedback {
|
|
|
34
27
|
display: inline-block;
|
|
35
28
|
}
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
/* Inlined from --qti-disabled-bg / --qti-disabled-color, which this button was the only reader
|
|
31
|
+
of anywhere in the repo. They were named as a global disabled vocabulary but no interaction
|
|
32
|
+
ever used them: the theme's disabled treatment is cursor only (see the note in qti-mixins.css). */
|
|
41
33
|
.button:disabled {
|
|
42
|
-
background-color:
|
|
43
|
-
color: var(--qti-
|
|
34
|
+
background-color: transparent;
|
|
35
|
+
color: var(--qti-fg);
|
|
44
36
|
cursor: not-allowed;
|
|
45
37
|
}
|
|
46
38
|
|
|
@@ -50,9 +42,9 @@ let QtiModalFeedback = class QtiModalFeedback extends QtiFeedback {
|
|
|
50
42
|
`; }
|
|
51
43
|
render() {
|
|
52
44
|
return html `
|
|
53
|
-
<dialog class="
|
|
45
|
+
<dialog class="cito-dialog" part="feedback" ?open="${this.showStatus === 'on'}">
|
|
54
46
|
<slot></slot>
|
|
55
|
-
<div style="margin-top: var(--qti-gap
|
|
47
|
+
<div style="margin-top: var(--qti-gap); text-align: center;">
|
|
56
48
|
<button class="button close-button" @click="${this.closeFeedback}">Close</button>
|
|
57
49
|
</div>
|
|
58
50
|
</dialog>
|
|
@@ -87,9 +79,5 @@ let QtiModalFeedback = class QtiModalFeedback extends QtiFeedback {
|
|
|
87
79
|
}
|
|
88
80
|
}
|
|
89
81
|
}
|
|
90
|
-
}
|
|
91
|
-
QtiModalFeedback = __decorate([
|
|
92
|
-
customElement('qti-modal-feedback')
|
|
93
|
-
], QtiModalFeedback);
|
|
94
|
-
export { QtiModalFeedback };
|
|
82
|
+
}
|
|
95
83
|
//# sourceMappingURL=qti-modal-feedback.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-modal-feedback.js","sourceRoot":"","sources":["../../../src/components/qti-modal-feedback/qti-modal-feedback.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"qti-modal-feedback.js","sourceRoot":"","sources":["../../../src/components/qti-modal-feedback/qti-modal-feedback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,OAAO,gBAAiB,SAAQ,WAAW;aAC/B,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsC3B,CAAC;IAEO,MAAM;QACb,OAAO,IAAI,CAAA;2DAC4C,IAAI,CAAC,UAAU,KAAK,IAAI;;;wDAG3B,IAAI,CAAC,aAAa;;;KAGrE,CAAC;IACJ,CAAC;IAED,YAAY;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,QAAQ,CAA6B,CAAC;QACpF,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAC3B,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC;IACH,CAAC;IAED,aAAa;QACX,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,QAAQ,CAA6B,CAAC;QACpF,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAC1B,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAC1B,CAAC;IACH,CAAC;IAEe,iBAAiB;QAC/B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;YAC7B,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;IAEkB,OAAO,CAAC,iBAAyD;QAClF,IAAI,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YACxC,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;gBAC7B,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,CAAC;QACH,CAAC;IACH,CAAC","sourcesContent":["import { css, html } from 'lit';\n\nimport { QtiFeedback } from '@qti-components/base';\n\nexport class QtiModalFeedback extends QtiFeedback {\n static override styles = css`\n .cito-dialog {\n background: var(--qti-bg);\n border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);\n border-radius: var(--qti-border-radius);\n padding: var(--qti-padding-box);\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1000;\n width: auto;\n max-width: 90%;\n }\n\n .button {\n border-radius: var(--qti-border-radius);\n padding: var(--qti-padding-box);\n background-color: var(--qti-bg-active);\n border: var(--qti-border-active);\n cursor: pointer;\n position: relative;\n display: inline-block;\n }\n\n /* Inlined from --qti-disabled-bg / --qti-disabled-color, which this button was the only reader\n of anywhere in the repo. They were named as a global disabled vocabulary but no interaction\n ever used them: the theme's disabled treatment is cursor only (see the note in qti-mixins.css). */\n .button:disabled {\n background-color: transparent;\n color: var(--qti-fg);\n cursor: not-allowed;\n }\n\n .button:focus {\n outline: var(--qti-focus-border-width) solid var(--qti-focus-color);\n }\n `;\n\n override render() {\n return html`\n <dialog class=\"cito-dialog\" part=\"feedback\" ?open=\"${this.showStatus === 'on'}\">\n <slot></slot>\n <div style=\"margin-top: var(--qti-gap); text-align: center;\">\n <button class=\"button close-button\" @click=\"${this.closeFeedback}\">Close</button>\n </div>\n </dialog>\n `;\n }\n\n openFeedback() {\n const dialog = this.shadowRoot?.querySelector('dialog') as HTMLDialogElement | null;\n if (dialog && !dialog.open) {\n dialog.showModal();\n }\n }\n\n closeFeedback() {\n const dialog = this.shadowRoot?.querySelector('dialog') as HTMLDialogElement | null;\n if (dialog && dialog.open) {\n dialog.close();\n this.showStatus = 'off';\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n if (this.showStatus === 'on') {\n this.openFeedback();\n }\n }\n\n protected override updated(changedProperties: Map<string | number | symbol, unknown>): void {\n if (changedProperties.has('showStatus')) {\n if (this.showStatus === 'on') {\n this.openFeedback();\n } else {\n this.closeFeedback();\n }\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-modal-feedback': QtiModalFeedback;\n }\n}\n"]}
|
|
@@ -6,10 +6,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { consume } from '@lit/context';
|
|
8
8
|
import { css, html } from 'lit';
|
|
9
|
-
import {
|
|
9
|
+
import { property, state } from 'lit/decorators.js';
|
|
10
10
|
import { itemContext } from '@qti-components/base';
|
|
11
11
|
import { QtiVariableDeclaration } from '@qti-components/base';
|
|
12
|
-
|
|
12
|
+
export class QtiOutcomeDeclaration extends QtiVariableDeclaration {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
15
|
this.externalScored = null;
|
|
@@ -71,7 +71,7 @@ let QtiOutcomeDeclaration = class QtiOutcomeDeclaration extends QtiVariableDecla
|
|
|
71
71
|
detail: { variable: outcomeVariable }
|
|
72
72
|
}));
|
|
73
73
|
}
|
|
74
|
-
}
|
|
74
|
+
}
|
|
75
75
|
__decorate([
|
|
76
76
|
property({ type: String, attribute: 'base-type' })
|
|
77
77
|
], QtiOutcomeDeclaration.prototype, "baseType", void 0);
|
|
@@ -88,8 +88,4 @@ __decorate([
|
|
|
88
88
|
consume({ context: itemContext, subscribe: true }),
|
|
89
89
|
state()
|
|
90
90
|
], QtiOutcomeDeclaration.prototype, "itemContext", void 0);
|
|
91
|
-
QtiOutcomeDeclaration = __decorate([
|
|
92
|
-
customElement('qti-outcome-declaration')
|
|
93
|
-
], QtiOutcomeDeclaration);
|
|
94
|
-
export { QtiOutcomeDeclaration };
|
|
95
91
|
//# sourceMappingURL=qti-outcome-declaration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-outcome-declaration.js","sourceRoot":"","sources":["../../../src/components/qti-outcome-declaration/qti-outcome-declaration.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"qti-outcome-declaration.js","sourceRoot":"","sources":["../../../src/components/qti-outcome-declaration/qti-outcome-declaration.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAA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,EAAE,iBAAiB,EAAE,CAAC;6DAA2D;AACxF;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAoB;AACnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAA0B;AAI9C;IAFN,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAClD,KAAK,EAAE;0DACyB","sourcesContent":["import { consume } from '@lit/context';\nimport { css, html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { itemContext } from '@qti-components/base';\nimport { QtiVariableDeclaration } from '@qti-components/base';\n\nimport type { BaseType, Cardinality } from '@qti-components/base';\nimport type { OutcomeVariable } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\n\nexport class QtiOutcomeDeclaration extends QtiVariableDeclaration {\n @property({ type: String, attribute: 'base-type' }) baseType: BaseType;\n @property({ type: String, attribute: 'external-scored' }) externalScored: 'human' | 'externalMachine' | null = null;\n @property({ type: String }) identifier: string;\n @property({ type: String }) cardinality: Cardinality;\n\n @consume({ context: itemContext, subscribe: true })\n @state()\n public itemContext?: ItemContext;\n\n static override styles = [\n css`\n :host {\n display: none;\n }\n `\n ];\n\n override render() {\n const value = this.itemContext?.variables.find(v => v.identifier === this.identifier)?.value;\n return html`${JSON.stringify(value, null, 2)}`;\n }\n\n get interpolationTable(): Map<number, number> | null {\n const table = this.querySelector('qti-interpolation-table');\n if (table) {\n const entries = new Map<number, number>();\n for (const entry of table.querySelectorAll('qti-interpolation-table-entry')) {\n if (!entry.getAttribute('source-value') && entry.getAttribute('target-value')) {\n console.error('source-value or target-value is missing in qti-interpolation-table-entry');\n }\n const sourceValue = parseFloat(entry.getAttribute('source-value'));\n const targetValue = parseFloat(entry.getAttribute('target-value'));\n if (isNaN(sourceValue) || isNaN(targetValue)) {\n console.error('source-value or target-value is not a number in qti-interpolation-table-entry');\n }\n entries.set(sourceValue, targetValue);\n }\n return entries;\n }\n return null;\n }\n\n public override connectedCallback() {\n super.connectedCallback();\n\n const defaultValue = this.defaultValues(this.cardinality);\n\n const outcomeVariable: OutcomeVariable = {\n identifier: this.identifier,\n cardinality: this.cardinality,\n baseType: this.baseType,\n defaultValue: defaultValue,\n type: 'outcome',\n value: null,\n interpolationTable: this.interpolationTable,\n externalScored: this.externalScored\n };\n // At runtime, outcome variables are instantiated as part of an item session.\n // Their values may be initialized with a default value and/or set during response processing.\n // If no default value is given in the declaration then the outcome variable is initialized to NULL unless the outcome is of a numeric type (integer or float) in which case it is initialized to 0.\n outcomeVariable.value = defaultValue;\n if (\n (outcomeVariable.value === null || outcomeVariable.value == undefined) &&\n (outcomeVariable.baseType === 'integer' || outcomeVariable.baseType === 'float')\n ) {\n outcomeVariable.value = '0';\n }\n this.dispatchEvent(\n new CustomEvent('qti-register-variable', {\n bubbles: true,\n composed: true,\n detail: { variable: outcomeVariable }\n })\n );\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-outcome-declaration': QtiOutcomeDeclaration;\n }\n}\n"]}
|
|
@@ -6,10 +6,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { consume } from '@lit/context';
|
|
8
8
|
import { css, html } from 'lit';
|
|
9
|
-
import {
|
|
9
|
+
import { property, state } from 'lit/decorators.js';
|
|
10
10
|
import { itemContext } from '@qti-components/base';
|
|
11
11
|
import { QtiVariableDeclaration } from '@qti-components/base';
|
|
12
|
-
|
|
12
|
+
export class QtiResponseDeclaration extends QtiVariableDeclaration {
|
|
13
13
|
static { this.styles = [
|
|
14
14
|
css `
|
|
15
15
|
:host {
|
|
@@ -96,7 +96,7 @@ let QtiResponseDeclaration = class QtiResponseDeclaration extends QtiVariableDec
|
|
|
96
96
|
areaMapEntries
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
}
|
|
99
|
+
}
|
|
100
100
|
__decorate([
|
|
101
101
|
property({ type: String, attribute: 'base-type' })
|
|
102
102
|
], QtiResponseDeclaration.prototype, "baseType", void 0);
|
|
@@ -110,8 +110,4 @@ __decorate([
|
|
|
110
110
|
consume({ context: itemContext, subscribe: true }),
|
|
111
111
|
state()
|
|
112
112
|
], QtiResponseDeclaration.prototype, "itemContext", void 0);
|
|
113
|
-
QtiResponseDeclaration = __decorate([
|
|
114
|
-
customElement('qti-response-declaration')
|
|
115
|
-
], QtiResponseDeclaration);
|
|
116
|
-
export { QtiResponseDeclaration };
|
|
117
113
|
//# sourceMappingURL=qti-response-declaration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-response-declaration.js","sourceRoot":"","sources":["../../../src/components/qti-response-declaration/qti-response-declaration.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"qti-response-declaration.js","sourceRoot":"","sources":["../../../src/components/qti-response-declaration/qti-response-declaration.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAQ9D,MAAM,OAAO,sBAAuB,SAAQ,sBAAsB;aAWhD,WAAM,GAAG;QACvB,GAAG,CAAA;;;;KAIF;KACF,CAAC;IAEO,MAAM;QACb,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,I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;YACZ,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU;YACjD,UAAU,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW;YACnD,cAAc;SACf,CAAC;IACJ,CAAC;;AA5GmD;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;wDAAoB;AAE3C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAAoB;AAEnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAA0B;AAI9C;IAFN,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAClD,KAAK,EAAE;2DACyB","sourcesContent":["import { consume } from '@lit/context';\nimport { css, html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { itemContext } from '@qti-components/base';\nimport { QtiVariableDeclaration } from '@qti-components/base';\n\nimport type { QtiAreaMapping } from '@qti-components/base';\nimport type { BaseType, Cardinality } from '@qti-components/base';\nimport type { ResponseVariable } from '@qti-components/base';\nimport type { QtiMapping } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\n\nexport class QtiResponseDeclaration extends QtiVariableDeclaration {\n @property({ type: String, attribute: 'base-type' }) baseType: BaseType;\n\n @property({ type: String }) identifier: string;\n\n @property({ type: String }) cardinality: Cardinality;\n\n @consume({ context: itemContext, subscribe: true })\n @state()\n public itemContext?: ItemContext;\n\n static override styles = [\n css`\n :host {\n display: none;\n }\n `\n ];\n\n override render() {\n const value = this.itemContext?.variables.find(v => v.identifier === this.identifier)?.value;\n return html`${JSON.stringify(value, null, 2)}`;\n }\n\n public override connectedCallback() {\n super.connectedCallback();\n const defaultValue = this.defaultValues(this.cardinality);\n\n const responseVariable: ResponseVariable = {\n baseType: this.baseType,\n identifier: this.identifier,\n correctResponse: this.#correctResponse,\n cardinality: this.cardinality || 'single',\n mapping: this.#mapping,\n defaultValue,\n areaMapping: this.#areaMapping,\n value: null,\n type: 'response',\n candidateResponse: null\n };\n responseVariable.value = defaultValue;\n\n this.dispatchEvent(\n new CustomEvent('qti-register-variable', {\n bubbles: true,\n composed: true,\n detail: { variable: responseVariable }\n })\n );\n }\n\n get #correctResponse(): string | string[] {\n let result: string | string[];\n const correctResponse = this.querySelector('qti-correct-response');\n if (correctResponse) {\n const values = correctResponse.querySelectorAll('qti-value');\n if (this.cardinality === 'single' && values.length > 0) {\n result = values[0].textContent.trim();\n values[0].remove();\n } else if (this.cardinality !== 'single') {\n result = [];\n for (let i = 0; i < values.length; i++) {\n result.push(values[i].textContent.trim());\n values[i].remove();\n }\n }\n }\n return result;\n }\n\n get #mapping(): QtiMapping {\n const mappingElement = this.querySelector('qti-mapping');\n const lowerBound = parseFloat(mappingElement?.getAttribute('lower-bound'));\n const uppperBound = parseFloat(mappingElement?.getAttribute('upper-bound'));\n const mappingValue = {\n defaultValue: Number(mappingElement?.getAttribute('default-value')) || 0,\n lowerBound: isNaN(lowerBound) ? null : lowerBound,\n upperBound: isNaN(uppperBound) ? null : uppperBound,\n mapEntries: Array.from(mappingElement?.querySelectorAll('qti-map-entry') || []).map(el => ({\n mapKey: el.getAttribute('map-key') || '',\n mappedValue: Number(el.getAttribute('mapped-value')) || 0,\n caseSensitive: el.hasAttribute('case-sensitive') ? el.getAttribute('case-sensitive') !== 'false' : false\n }))\n };\n return mappingValue;\n }\n\n get #areaMapping(): QtiAreaMapping {\n const areaMappingElement = this.querySelector('qti-area-mapping') as HTMLElement;\n\n const defaultValue = Number(areaMappingElement?.getAttribute('default-value')) || 0;\n const lowerBound = parseFloat(areaMappingElement?.getAttribute('lower-bound'));\n const uppperBound = parseFloat(areaMappingElement?.getAttribute('upper-bound'));\n\n const areaMapEntries = Array.from(areaMappingElement?.querySelectorAll('qti-area-map-entry') || []).map(\n (el: HTMLElement) => ({\n shape: (el.getAttribute('shape') as 'default' | 'circle' | 'rect' | 'ellipse' | 'poly') || 'default',\n coords: el.getAttribute('coords') || '',\n mappedValue: Number(el.getAttribute('mapped-value')) || 0,\n defaultValue: Number(el.getAttribute('default-value')) || 0\n })\n );\n\n return {\n defaultValue,\n lowerBound: isNaN(lowerBound) ? null : lowerBound,\n upperBound: isNaN(uppperBound) ? null : uppperBound,\n areaMapEntries\n };\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-response-declaration': QtiResponseDeclaration;\n }\n}\n"]}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
1
|
import { css, html, LitElement } from 'lit';
|
|
8
|
-
import { customElement } from 'lit/decorators.js';
|
|
9
2
|
import { mapResponse, mapResponsePoint, matchCorrect } from '../../internal/template-strings';
|
|
10
|
-
|
|
3
|
+
export class QtiResponseProcessing extends LitElement {
|
|
11
4
|
static { this.styles = [
|
|
12
5
|
css `
|
|
13
6
|
:host {
|
|
@@ -50,9 +43,5 @@ let QtiResponseProcessing = class QtiResponseProcessing extends LitElement {
|
|
|
50
43
|
#fragmentFromString(strHTML) {
|
|
51
44
|
return document.createRange().createContextualFragment(strHTML);
|
|
52
45
|
}
|
|
53
|
-
}
|
|
54
|
-
QtiResponseProcessing = __decorate([
|
|
55
|
-
customElement('qti-response-processing')
|
|
56
|
-
], QtiResponseProcessing);
|
|
57
|
-
export { QtiResponseProcessing };
|
|
46
|
+
}
|
|
58
47
|
//# sourceMappingURL=qti-response-processing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-response-processing.js","sourceRoot":"","sources":["../../../src/components/qti-response-processing/qti-response-processing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"qti-response-processing.js","sourceRoot":"","sources":["../../../src/components/qti-response-processing/qti-response-processing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAI5C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAI9F,MAAM,OAAO,qBAAsB,SAAQ,UAAU;aACnC,WAAM,GAAG;QACvB,GAAG,CAAA;;;;KAIF;KACF,CAAC;IAEO,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;IAEM,OAAO;QACZ,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QAC3D,IAAI,CAAC,cAAc;YAAE,OAAO;QAC5B,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAA6B,CAAC;QAC7D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IAEe,YAAY,CAAC,kBAAqE;QAChG,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;YAClC,MAAM,oBAAoB,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACvE,MAAM,YAAY,GAAG,oBAAoB,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAC/F,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;YACpB,QAAQ,YAAY,EAAE,CAAC;gBACrB,KAAK,cAAc,CAAC,CAAC,CAAC;oBACpB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;oBAC5F,MAAM;gBACR,CAAC;gBACD,KAAK,oBAAoB,CAAC,CAAC,CAAC;oBAC1B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;oBACjG,MAAM;gBACR,CAAC;gBACD,KAAK,eAAe;oBAClB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;oBAC7F,MAAM;YACV,CAAC;QACH,CAAC;IACH,CAAC;IAED,mBAAmB,CAAC,OAAe;QACjC,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC","sourcesContent":["import { css, html, LitElement } from 'lit';\n\nimport { type QtiRuleBase } from '@qti-components/base';\n\nimport { mapResponse, mapResponsePoint, matchCorrect } from '../../internal/template-strings';\n\nimport type { PropertyValueMap } from 'lit';\n\nexport class QtiResponseProcessing extends LitElement {\n static override styles = [\n css`\n :host {\n display: none;\n }\n `\n ];\n\n override render() {\n return html`<slot></slot>`;\n }\n\n public process() {\n const assessmentItem = this.closest('qti-assessment-item');\n if (!assessmentItem) return;\n const rules = [...this.children] as unknown as QtiRuleBase[];\n for (const rule of rules) {\n rule.process();\n }\n }\n\n public override firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {\n if (this.getAttribute('template')) {\n const splittedTemplateName = this.getAttribute('template')!.split('/');\n const templateName = splittedTemplateName[splittedTemplateName.length - 1].replace('.xml', '');\n this.innerHTML = '';\n switch (templateName) {\n case 'map_response': {\n this.appendChild(this.#fragmentFromString(mapResponse).firstElementChild.firstElementChild);\n break;\n }\n case 'map_response_point': {\n this.appendChild(this.#fragmentFromString(mapResponsePoint).firstElementChild.firstElementChild);\n break;\n }\n case 'match_correct':\n this.appendChild(this.#fragmentFromString(matchCorrect).firstElementChild.firstElementChild);\n break;\n }\n }\n }\n\n #fragmentFromString(strHTML: string) {\n return document.createRange().createContextualFragment(strHTML);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-response-processing': QtiResponseProcessing;\n }\n}\n"]}
|