@citolab/qti-components 7.3.1 → 7.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/chunks/chunk-2F7QLIQX.js +2 -0
- package/cdn/chunks/chunk-2FHBMRTL.js +10 -0
- package/cdn/chunks/chunk-2IPVI6JS.js +8 -0
- package/cdn/chunks/chunk-2MMQH3OR.js +8 -0
- package/cdn/chunks/chunk-3OIAVUFK.js +8 -0
- package/cdn/chunks/chunk-3XOKPK45.js +2 -0
- package/cdn/chunks/chunk-5DVOEPIP.js +8 -0
- package/cdn/chunks/chunk-5PA3GEIX.js +2 -0
- package/cdn/chunks/chunk-7JO3EE5V.js +5 -0
- package/cdn/chunks/chunk-AMH674XL.js +1450 -0
- package/cdn/chunks/chunk-C26NWYVO.js +2 -0
- package/cdn/chunks/chunk-C55DPNSW.js +8 -0
- package/cdn/chunks/chunk-CIIKVJF7.js +2 -0
- package/cdn/chunks/chunk-CMGZUMGV.js +2 -0
- package/cdn/chunks/chunk-DZTNCG5K.js +2 -0
- package/cdn/chunks/chunk-E7FZUPJ2.js +8 -0
- package/cdn/chunks/chunk-H3WTP2FL.js +2 -0
- package/cdn/chunks/chunk-IEHCQ5EK.js +2 -0
- package/cdn/chunks/chunk-LGSTDI7O.js +8 -0
- package/cdn/chunks/chunk-N3YBYEEI.js +2 -0
- package/cdn/chunks/chunk-N7K6VO7F.js +1 -0
- package/cdn/chunks/chunk-NPYS4GGN.js +5 -0
- package/cdn/chunks/chunk-OGZEE7T7.js +8 -0
- package/cdn/chunks/chunk-QA3FBQSF.js +5 -0
- package/cdn/chunks/chunk-QHO7IBHQ.js +2 -0
- package/cdn/chunks/chunk-QT25DBDO.js +8 -0
- package/cdn/chunks/chunk-SSBR2KEX.js +8 -0
- package/cdn/chunks/chunk-TB7NCJUL.js +8 -0
- package/cdn/chunks/chunk-UN2WT4WS.js +2 -0
- package/cdn/chunks/chunk-V6LLE3H4.js +8 -0
- package/cdn/chunks/chunk-X5K7LBUM.js +8 -0
- package/cdn/chunks/chunk-X6XRXEW2.js +2 -0
- package/cdn/chunks/chunk-Z6WP2K4O.js +1450 -0
- package/cdn/chunks/chunk-ZKETWB2E.js +8 -0
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +1 -1
- package/cdn/qti-components/index.js +1 -1
- package/cdn/qti-test/components/index.js +1 -1
- package/cdn/qti-test/components/test-next.js +1 -1
- package/cdn/qti-test/components/test-prev.js +1 -1
- package/cdn/qti-test/components/test-scoring-feedback.js +1 -1
- package/cdn/qti-test/components/test-stamp.js +1 -1
- package/cdn/qti-test/core/index.js +1 -1
- package/dist/chunks/chunk-3IAZELYI.js +90 -0
- package/dist/chunks/chunk-3IAZELYI.js.map +1 -0
- package/dist/chunks/chunk-3YJPKRFS.js +91 -0
- package/dist/chunks/chunk-3YJPKRFS.js.map +1 -0
- package/dist/chunks/chunk-4PL7XU3H.js +82 -0
- package/dist/chunks/chunk-4PL7XU3H.js.map +1 -0
- package/dist/chunks/chunk-4YWF7QTH.js +92 -0
- package/dist/chunks/chunk-4YWF7QTH.js.map +1 -0
- package/dist/chunks/chunk-5AZFPSD4.js +87 -0
- package/dist/chunks/chunk-5AZFPSD4.js.map +1 -0
- package/dist/chunks/chunk-5OZP32ZZ.js +90 -0
- package/dist/chunks/chunk-5OZP32ZZ.js.map +1 -0
- package/dist/chunks/chunk-5SU6S5L4.js +94 -0
- package/dist/chunks/chunk-5SU6S5L4.js.map +1 -0
- package/dist/chunks/chunk-5WHKITF6.js +90 -0
- package/dist/chunks/chunk-5WHKITF6.js.map +1 -0
- package/dist/chunks/chunk-64JRMFTB.js +93 -0
- package/dist/chunks/chunk-64JRMFTB.js.map +1 -0
- package/dist/chunks/chunk-7RFWGVJR.js +109 -0
- package/dist/chunks/chunk-7RFWGVJR.js.map +1 -0
- package/dist/chunks/chunk-BAG5H6N2.js +7970 -0
- package/dist/chunks/chunk-BAG5H6N2.js.map +1 -0
- package/dist/chunks/chunk-CWT66FG4.js +95 -0
- package/dist/chunks/chunk-CWT66FG4.js.map +1 -0
- package/dist/chunks/chunk-F2JDNMKV.js +100 -0
- package/dist/chunks/chunk-F2JDNMKV.js.map +1 -0
- package/dist/chunks/chunk-F5OPIJ4X.js +90 -0
- package/dist/chunks/chunk-F5OPIJ4X.js.map +1 -0
- package/dist/chunks/chunk-FZHYC3TU.js +92 -0
- package/dist/chunks/chunk-FZHYC3TU.js.map +1 -0
- package/dist/chunks/chunk-GDNPYP37.js +85 -0
- package/dist/chunks/chunk-GDNPYP37.js.map +1 -0
- package/dist/chunks/chunk-H2HBYOZZ.js +90 -0
- package/dist/chunks/chunk-H2HBYOZZ.js.map +1 -0
- package/dist/chunks/chunk-H6RDLSTK.js +87 -0
- package/dist/chunks/chunk-H6RDLSTK.js.map +1 -0
- package/dist/chunks/chunk-IDRQNT6W.js +86 -0
- package/dist/chunks/chunk-IDRQNT6W.js.map +1 -0
- package/dist/chunks/chunk-KXDEFGCK.js +887 -0
- package/dist/chunks/chunk-KXDEFGCK.js.map +1 -0
- package/dist/chunks/chunk-KZAEUKGI.js +100 -0
- package/dist/chunks/chunk-KZAEUKGI.js.map +1 -0
- package/dist/chunks/chunk-LBL5YIK7.js +94 -0
- package/dist/chunks/chunk-LBL5YIK7.js.map +1 -0
- package/dist/chunks/chunk-LJ4KYDFF.js +56 -0
- package/dist/chunks/chunk-LJ4KYDFF.js.map +1 -0
- package/dist/chunks/chunk-LMMYXE6U.js +85 -0
- package/dist/chunks/chunk-LMMYXE6U.js.map +1 -0
- package/dist/chunks/chunk-MTWSJYVA.js +86 -0
- package/dist/chunks/chunk-MTWSJYVA.js.map +1 -0
- package/dist/chunks/chunk-OD6DYLAO.js +7940 -0
- package/dist/chunks/chunk-OD6DYLAO.js.map +1 -0
- package/dist/chunks/chunk-OLZSWYQO.js +100 -0
- package/dist/chunks/chunk-OLZSWYQO.js.map +1 -0
- package/dist/chunks/chunk-PI2VZUCF.js +91 -0
- package/dist/chunks/chunk-PI2VZUCF.js.map +1 -0
- package/dist/chunks/chunk-PRO3U224.js +91 -0
- package/dist/chunks/chunk-PRO3U224.js.map +1 -0
- package/dist/chunks/chunk-RZK54XLD.js +100 -0
- package/dist/chunks/chunk-RZK54XLD.js.map +1 -0
- package/dist/chunks/chunk-SBY26ONA.js +99 -0
- package/dist/chunks/chunk-SBY26ONA.js.map +1 -0
- package/dist/chunks/chunk-W7DAMVVM.js +90 -0
- package/dist/chunks/chunk-W7DAMVVM.js.map +1 -0
- package/dist/chunks/chunk-WH6TRM5K.js +82 -0
- package/dist/chunks/chunk-WH6TRM5K.js.map +1 -0
- package/dist/chunks/chunk-WLDX63OS.js +92 -0
- package/dist/chunks/chunk-WLDX63OS.js.map +1 -0
- package/dist/chunks/chunk-WTV3RW6F.js +91 -0
- package/dist/chunks/chunk-WTV3RW6F.js.map +1 -0
- package/dist/chunks/chunk-X5L7SQQN.js +887 -0
- package/dist/chunks/chunk-X5L7SQQN.js.map +1 -0
- package/dist/chunks/chunk-X5RBTIXP.js +86 -0
- package/dist/chunks/chunk-X5RBTIXP.js.map +1 -0
- package/dist/exports/computed-item.context.d.ts +1 -1
- package/dist/exports/computed.context.d.ts +2 -2
- package/dist/exports/interaction.d.ts +1 -1
- package/dist/exports/item.context.d.ts +1 -1
- package/dist/exports/qti-assessment-item.context.d.ts +1 -1
- package/dist/exports/qti-condition-expression.d.ts +1 -1
- package/dist/exports/qti-expression.d.ts +1 -1
- package/dist/exports/session.context.d.ts +2 -2
- package/dist/exports/test.context.d.ts +1 -1
- package/dist/exports/variables.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -7
- package/dist/qti-components/index.d.ts +2 -2
- package/dist/qti-components/index.js +1 -2
- package/dist/qti-components-jsx.d.ts +73 -12
- package/dist/qti-item/components/item-show-correct-response.d.ts +1 -1
- package/dist/qti-item/components/print-item-variables.d.ts +1 -1
- package/dist/qti-item/core/index.d.ts +1 -1
- package/dist/qti-loader/index.d.ts +1 -1
- package/dist/qti-response-declaration-pCFZA_aW.d.ts +1356 -0
- package/dist/qti-test/components/index.d.ts +2 -2
- package/dist/qti-test/components/index.js +4 -5
- package/dist/qti-test/components/test-navigation.d.ts +2 -2
- package/dist/qti-test/components/test-next.d.ts +14 -16
- package/dist/qti-test/components/test-next.js +1 -1
- package/dist/qti-test/components/test-prev.d.ts +16 -18
- package/dist/qti-test/components/test-prev.js +1 -3
- package/dist/qti-test/components/test-print-context.d.ts +2 -2
- package/dist/qti-test/components/test-print-item-variables.d.ts +2 -2
- package/dist/qti-test/components/test-scoring-buttons.d.ts +2 -2
- package/dist/qti-test/components/test-scoring-feedback.d.ts +2 -2
- package/dist/qti-test/components/test-scoring-feedback.js +1 -1
- package/dist/qti-test/components/test-show-correct-response.d.ts +2 -2
- package/dist/qti-test/components/test-stamp.d.ts +2 -2
- package/dist/qti-test/components/test-stamp.js +1 -1
- package/dist/qti-test/core/index.d.ts +3 -3
- package/dist/qti-test/core/index.js +2 -3
- package/dist/qti-test-feedback-2xjKezsY.d.ts +85 -0
- package/dist/vscode.html-custom-data.json +39 -15
- package/package.json +1 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
btn,
|
|
3
|
+
dis
|
|
4
|
+
} from "./chunk-5ZHHNEDA.js";
|
|
5
|
+
import {
|
|
6
|
+
computedContext
|
|
7
|
+
} from "./chunk-AZIKAG7K.js";
|
|
8
|
+
import {
|
|
9
|
+
__decorateClass
|
|
10
|
+
} from "./chunk-H2JE6IVU.js";
|
|
11
|
+
|
|
12
|
+
// src/lib/qti-test/components/test-next.ts
|
|
13
|
+
import { css, html, LitElement } from "lit";
|
|
14
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
15
|
+
import { consume } from "@lit/context";
|
|
16
|
+
var TestNext = class extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.disabled = false;
|
|
20
|
+
this._internallyDisabled = false;
|
|
21
|
+
this._internals = this.attachInternals();
|
|
22
|
+
this._internals.role = "button";
|
|
23
|
+
this._internals.ariaLabel = "Next item";
|
|
24
|
+
this.addEventListener("click", (e) => {
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
if (!this.effectiveDisabled) {
|
|
27
|
+
this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// Virtual disabled state that the button actually obeys
|
|
32
|
+
get effectiveDisabled() {
|
|
33
|
+
return this._internallyDisabled || this.disabled;
|
|
34
|
+
}
|
|
35
|
+
// Optional: Reflect this state in an attribute if needed for CSS
|
|
36
|
+
updated() {
|
|
37
|
+
if (this.effectiveDisabled) {
|
|
38
|
+
this.setAttribute("effective-disabled", "");
|
|
39
|
+
} else {
|
|
40
|
+
this.removeAttribute("effective-disabled");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
willUpdate(_changedProperties) {
|
|
44
|
+
if (!this.computedContext) return;
|
|
45
|
+
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
46
|
+
if (!testPart) return;
|
|
47
|
+
this.sectionItems = testPart.sections.flatMap((section) => section.items);
|
|
48
|
+
this.itemIndex = this.sectionItems.findIndex((item) => item.active);
|
|
49
|
+
this.checkDisabled();
|
|
50
|
+
}
|
|
51
|
+
checkDisabled() {
|
|
52
|
+
const internallyDisabled = !this.computedContext || this.itemIndex < 0 || this.itemIndex >= this.sectionItems?.length - 1;
|
|
53
|
+
this._internallyDisabled = internallyDisabled;
|
|
54
|
+
}
|
|
55
|
+
_requestItem(identifier) {
|
|
56
|
+
this.dispatchEvent(
|
|
57
|
+
new CustomEvent("qti-request-navigation", {
|
|
58
|
+
composed: true,
|
|
59
|
+
bubbles: true,
|
|
60
|
+
detail: {
|
|
61
|
+
type: "item",
|
|
62
|
+
id: identifier
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
return html`<slot></slot>`;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
TestNext.styles = css`
|
|
72
|
+
:host {
|
|
73
|
+
${btn};
|
|
74
|
+
}
|
|
75
|
+
:host([effective-disabled]) {
|
|
76
|
+
${dis};
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
__decorateClass([
|
|
80
|
+
property({ type: Boolean, reflect: true })
|
|
81
|
+
], TestNext.prototype, "disabled", 2);
|
|
82
|
+
__decorateClass([
|
|
83
|
+
state()
|
|
84
|
+
], TestNext.prototype, "_internallyDisabled", 2);
|
|
85
|
+
__decorateClass([
|
|
86
|
+
consume({ context: computedContext, subscribe: true })
|
|
87
|
+
], TestNext.prototype, "computedContext", 2);
|
|
88
|
+
TestNext = __decorateClass([
|
|
89
|
+
customElement("test-next")
|
|
90
|
+
], TestNext);
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
TestNext
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=chunk-CWT66FG4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-next.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport * as styles from './styles';\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedContext, ComputedItem } from '../../exports/computed.context';\n\n@customElement('test-next')\nexport class TestNext extends LitElement {\n @property({ type: Boolean, reflect: true })\n public disabled = false; // externally controlled\n\n @state()\n private _internallyDisabled = false; // internal logic\n\n @consume({ context: computedContext, subscribe: true })\n protected computedContext: ComputedContext;\n\n sectionItems: ComputedItem[];\n itemIndex: number;\n\n static styles = css`\n :host {\n ${styles.btn};\n }\n :host([effective-disabled]) {\n ${styles.dis};\n }\n `;\n\n private _internals: ElementInternals;\n\n constructor() {\n super();\n\n this._internals = this.attachInternals();\n this._internals.role = 'button';\n this._internals.ariaLabel = 'Next item';\n\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this.effectiveDisabled) {\n this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);\n }\n });\n }\n\n // Virtual disabled state that the button actually obeys\n get effectiveDisabled() {\n return this._internallyDisabled || this.disabled;\n }\n\n // Optional: Reflect this state in an attribute if needed for CSS\n updated() {\n if (this.effectiveDisabled) {\n this.setAttribute('effective-disabled', '');\n } else {\n this.removeAttribute('effective-disabled');\n }\n }\n\n willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n if (!this.computedContext) return;\n\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n if (!testPart) return;\n\n this.sectionItems = testPart.sections.flatMap(section => section.items);\n this.itemIndex = this.sectionItems.findIndex(item => item.active);\n this.checkDisabled();\n }\n\n checkDisabled() {\n // This determines if it *should* be disabled based on internal logic\n const internallyDisabled =\n !this.computedContext || this.itemIndex < 0 || this.itemIndex >= this.sectionItems?.length - 1;\n\n this._internallyDisabled = internallyDisabled;\n }\n\n protected _requestItem(identifier: string): void {\n this.dispatchEvent(\n new CustomEvent('qti-request-navigation', {\n composed: true,\n bubbles: true,\n detail: {\n type: 'item',\n id: identifier\n }\n })\n );\n }\n\n render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-next': TestNext;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,kBAAkB;AACtC,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,eAAe;AAQjB,IAAM,WAAN,cAAuB,WAAW;AAAA,EAwBvC,cAAc;AACZ,UAAM;AAvBR,SAAO,WAAW;AAGlB,SAAQ,sBAAsB;AAsB5B,SAAK,aAAa,KAAK,gBAAgB;AACvC,SAAK,WAAW,OAAO;AACvB,SAAK,WAAW,YAAY;AAE5B,SAAK,iBAAiB,SAAS,OAAK;AAClC,QAAE,eAAe;AACjB,UAAI,CAAC,KAAK,mBAAmB;AAC3B,aAAK,aAAa,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AQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAP3C,SAQD;AARC,WAAN;AAAA,EADN,cAAc,WAAW;AAAA,GACb;","names":["testPart"]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import {
|
|
2
|
+
btn,
|
|
3
|
+
dis
|
|
4
|
+
} from "./chunk-5ZHHNEDA.js";
|
|
5
|
+
import {
|
|
6
|
+
computedContext
|
|
7
|
+
} from "./chunk-AZIKAG7K.js";
|
|
8
|
+
import {
|
|
9
|
+
__decorateClass
|
|
10
|
+
} from "./chunk-H2JE6IVU.js";
|
|
11
|
+
|
|
12
|
+
// src/lib/qti-test/components/test-prev.ts
|
|
13
|
+
import { css, html, LitElement } from "lit";
|
|
14
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
15
|
+
import { consume } from "@lit/context";
|
|
16
|
+
var TestPrev = class extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.disabled = true;
|
|
20
|
+
this._internallyDisabled = true;
|
|
21
|
+
this._internals = this.attachInternals();
|
|
22
|
+
this._internals.role = "button";
|
|
23
|
+
this._internals.ariaLabel = "Previous item";
|
|
24
|
+
this.addEventListener("click", (e) => {
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
if (!this.effectiveDisabled) {
|
|
27
|
+
this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// Computed effective state
|
|
32
|
+
get effectiveDisabled() {
|
|
33
|
+
return this._internallyDisabled || this.disabled;
|
|
34
|
+
}
|
|
35
|
+
updated() {
|
|
36
|
+
if (this.effectiveDisabled) {
|
|
37
|
+
this.setAttribute("effective-disabled", "");
|
|
38
|
+
} else {
|
|
39
|
+
this.removeAttribute("effective-disabled");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// @watch('computedContext')
|
|
43
|
+
// _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {
|
|
44
|
+
// if (newValue) {
|
|
45
|
+
// this.disabled = false;
|
|
46
|
+
// }
|
|
47
|
+
// }
|
|
48
|
+
willUpdate(_changedProperties) {
|
|
49
|
+
if (!this.computedContext) return;
|
|
50
|
+
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
51
|
+
if (!testPart) return;
|
|
52
|
+
this.sectionItems = testPart.sections.flatMap((section) => section.items);
|
|
53
|
+
this.itemIndex = this.sectionItems.findIndex((item) => item.active);
|
|
54
|
+
this.checkDisabled();
|
|
55
|
+
}
|
|
56
|
+
checkDisabled() {
|
|
57
|
+
console.log("checkDisabled", this.itemIndex, this.sectionItems);
|
|
58
|
+
this._internallyDisabled = !this.computedContext || this.itemIndex <= 0 || this.itemIndex === -1;
|
|
59
|
+
}
|
|
60
|
+
_requestItem(identifier) {
|
|
61
|
+
this.dispatchEvent(
|
|
62
|
+
new CustomEvent("qti-request-navigation", {
|
|
63
|
+
composed: true,
|
|
64
|
+
bubbles: true,
|
|
65
|
+
detail: {
|
|
66
|
+
type: "item",
|
|
67
|
+
id: identifier
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
return html`<slot></slot>`;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
TestPrev.styles = css`
|
|
77
|
+
:host {
|
|
78
|
+
${btn};
|
|
79
|
+
}
|
|
80
|
+
:host([effective-disabled]) {
|
|
81
|
+
${dis};
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
__decorateClass([
|
|
85
|
+
property({ type: Boolean, reflect: true })
|
|
86
|
+
], TestPrev.prototype, "disabled", 2);
|
|
87
|
+
__decorateClass([
|
|
88
|
+
state()
|
|
89
|
+
], TestPrev.prototype, "_internallyDisabled", 2);
|
|
90
|
+
__decorateClass([
|
|
91
|
+
consume({ context: computedContext, subscribe: true })
|
|
92
|
+
], TestPrev.prototype, "computedContext", 2);
|
|
93
|
+
TestPrev = __decorateClass([
|
|
94
|
+
customElement("test-prev")
|
|
95
|
+
], TestPrev);
|
|
96
|
+
|
|
97
|
+
export {
|
|
98
|
+
TestPrev
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=chunk-F2JDNMKV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-prev.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport * as styles from './styles';\nimport { watch } from '../../decorators';\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedContext, ComputedItem } from '../../exports/computed.context';\n\n@customElement('test-prev')\nexport class TestPrev extends LitElement {\n // External control\n @property({ type: Boolean, reflect: true })\n public disabled = true;\n\n // Internal logic override\n @state()\n private _internallyDisabled = true;\n\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n sectionItems: ComputedItem[];\n itemIndex: number;\n\n static styles = css`\n :host {\n ${styles.btn};\n }\n :host([effective-disabled]) {\n ${styles.dis};\n }\n `;\n\n private _internals: ElementInternals;\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n this._internals.role = 'button';\n this._internals.ariaLabel = 'Previous item';\n\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this.effectiveDisabled) {\n this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);\n }\n });\n }\n\n // Computed effective state\n get effectiveDisabled() {\n return this._internallyDisabled || this.disabled;\n }\n\n updated() {\n // Reflect effective state as attribute for styling\n if (this.effectiveDisabled) {\n this.setAttribute('effective-disabled', '');\n } else {\n this.removeAttribute('effective-disabled');\n }\n }\n\n // @watch('computedContext')\n // _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {\n // if (newValue) {\n // this.disabled = false;\n // }\n // }\n\n willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n if (!this.computedContext) return;\n\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n if (!testPart) return;\n\n this.sectionItems = testPart.sections.flatMap(section => section.items);\n this.itemIndex = this.sectionItems.findIndex(item => item.active);\n\n this.checkDisabled();\n }\n\n checkDisabled() {\n console.log('checkDisabled', this.itemIndex, this.sectionItems);\n this._internallyDisabled = !this.computedContext || this.itemIndex <= 0 || this.itemIndex === -1;\n }\n\n protected _requestItem(identifier: string): void {\n this.dispatchEvent(\n new CustomEvent('qti-request-navigation', {\n composed: true,\n bubbles: true,\n detail: {\n type: 'item',\n id: identifier\n }\n })\n );\n }\n\n render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-prev': TestPrev;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,kBAAkB;AACtC,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,eAAe;AASjB,IAAM,WAAN,cAAuB,WAAW;AAAA,EA0BvC,cAAc;AACZ,UAAM;AAxBR,SAAO,WAAW;AAIlB,SAAQ,sBAAsB;AAqB5B,SAAK,aAAa,KAAK,gBAAgB;AACvC,SAAK,WAAW,OAAO;AACvB,SAAK,WAAW,YAAY;AAE5B,SAAK,iBAAiB,SAAS,OAAK;AAClC,QAAE,eAAe;AACjB,UAAI,CAAC,KAAK,mBAAmB;AAC3B,aAAK,aAAa,KAAK,aAAa,KAAK,YAAY,CAAC,EAAE,UAAU;AAAA,MACpE;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA,EAGA,IAAI,oBAAoB;AACtB,WAAO,KAAK,uBAAuB,KAAK;AAAA,EAC1C;AAAA,EAEA,UAAU;AAER,QAAI,KAAK,mBAAmB;AAC1B,WAAK,aAAa,sBAAsB,EAAE;AAAA,IAC5C,OAAO;AACL,WAAK,gBAAgB,oBAAoB;AAAA,IAC3C;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,WAAW,oBAA4D;AACrE,QAAI,CAAC,KAAK,gBAAiB;AAE3B,UAAM,WAAW,KAAK,iBAAiB,UAAU,KAAK,CAAAA,cAAYA,UAAS,MAAM;AACjF,QAAI,CAAC,SAAU;AAEf,SAAK,eAAe,SAAS,SAAS,QAAQ,aAAW,QAAQ,KAAK;AACtE,SAAK,YAAY,KAAK,aAAa,UAAU,UAAQ,KAAK,MAAM;AAEhE,SAAK,cAAc;AAAA,EACrB;AAAA,EAEA,gBAAgB;AACd,YAAQ,IAAI,iBAAiB,KAAK,WAAW,KAAK,YAAY;AAC9D,SAAK,sBAAsB,CAAC,KAAK,mBAAmB,KAAK,aAAa,KAAK,KAAK,cAAc;AAAA,EAChG;AAAA,EAEU,aAAa,YAA0B;AAC/C,SAAK;AAAA,MACH,IAAI,YAAY,0BAA0B;AAAA,QACxC,UAAU;AAAA,QACV,SAAS;AAAA,QACT,QAAQ;AAAA,UACN,MAAM;AAAA,UACN,IAAI;AAAA,QACN;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,EACT;AACF;AA9Fa,SAeJ,SAAS;AAAA;AAAA,QAEH,GAAG;AAAA;AAAA;AAAA,QAGH,GAAG;AAAA;AAAA;AAjBT;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAF/B,SAGJ;AAIC;AAAA,EADP,MAAM;AAAA,GANI,SAOH;AAGA;AAAA,EADP,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAT3C,SAUH;AAVG,WAAN;AAAA,EADN,cAAc,WAAW;AAAA,GACb;","names":["testPart"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computedContext
|
|
3
|
+
} from "./chunk-AZIKAG7K.js";
|
|
4
|
+
import {
|
|
5
|
+
__decorateClass
|
|
6
|
+
} from "./chunk-H2JE6IVU.js";
|
|
7
|
+
|
|
8
|
+
// src/lib/qti-test/components/test-stamp.ts
|
|
9
|
+
import { html, LitElement, nothing } from "lit";
|
|
10
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
11
|
+
import { prepareTemplate } from "stampino";
|
|
12
|
+
import { consume } from "@lit/context";
|
|
13
|
+
var TestStamp = class extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.debug = false;
|
|
17
|
+
this.stampContext = {
|
|
18
|
+
view: "candidate",
|
|
19
|
+
activeItem: {},
|
|
20
|
+
activeSection: {
|
|
21
|
+
items: []
|
|
22
|
+
},
|
|
23
|
+
activeTestpart: {
|
|
24
|
+
items: []
|
|
25
|
+
},
|
|
26
|
+
test: {}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
createRenderRoot() {
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
super.connectedCallback();
|
|
34
|
+
const templateElement = this.querySelector("template");
|
|
35
|
+
if (!templateElement) {
|
|
36
|
+
this.myTemplate = null;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this.myTemplate = prepareTemplate(templateElement);
|
|
40
|
+
}
|
|
41
|
+
willUpdate(_changedProperties) {
|
|
42
|
+
if (!this.computedContext) {
|
|
43
|
+
this.stampContext = null;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const activeTestPart = this.computedContext.testParts.find((testPart) => testPart.active);
|
|
47
|
+
const activeSection = activeTestPart?.sections?.find((section) => section.active);
|
|
48
|
+
const activeItem = activeSection?.items.find((item) => item.active);
|
|
49
|
+
const { variables, ...augmentedItem } = activeItem || {};
|
|
50
|
+
const augmentedTestPart = {
|
|
51
|
+
...activeTestPart,
|
|
52
|
+
items: activeTestPart.sections.flatMap((section) => section.items.map(({ variables: variables2, ...rest }) => rest)),
|
|
53
|
+
sections: activeTestPart.sections.map((section) => ({
|
|
54
|
+
...section,
|
|
55
|
+
items: section.items.map(({ variables: variables2, ...rest }) => rest)
|
|
56
|
+
}))
|
|
57
|
+
};
|
|
58
|
+
const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables: variables2, ...rest }) => rest) };
|
|
59
|
+
const { testParts, ...activeTest } = this.computedContext;
|
|
60
|
+
this.stampContext = {
|
|
61
|
+
view: this.computedContext.view,
|
|
62
|
+
activeItem: augmentedItem,
|
|
63
|
+
activeSection: augmentedSection,
|
|
64
|
+
activeTestpart: augmentedTestPart,
|
|
65
|
+
test: activeTest
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
|
|
70
|
+
${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
__decorateClass([
|
|
74
|
+
property({ type: Boolean, reflect: true })
|
|
75
|
+
], TestStamp.prototype, "debug", 2);
|
|
76
|
+
__decorateClass([
|
|
77
|
+
state(),
|
|
78
|
+
consume({ context: computedContext, subscribe: true })
|
|
79
|
+
], TestStamp.prototype, "computedContext", 2);
|
|
80
|
+
__decorateClass([
|
|
81
|
+
state()
|
|
82
|
+
], TestStamp.prototype, "stampContext", 2);
|
|
83
|
+
TestStamp = __decorateClass([
|
|
84
|
+
customElement("test-stamp")
|
|
85
|
+
], TestStamp);
|
|
86
|
+
|
|
87
|
+
export {
|
|
88
|
+
TestStamp
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=chunk-F5OPIJ4X.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-stamp.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { prepareTemplate } from 'stampino';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { View } from '../core/mixins/test-view.mixin';\nimport type { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n/**\n * A custom web component that renders a test stamp using the Lit framework.\n * This component is deprecated and will be removed in the future.\n * @customElement\n * @extends {LitElement}\n */\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\n /**\n * Indicates whether the component is in debug mode.\n * When set to `true`, the available objects and properties (i.e.: stampContext) is displayed.\n */\n @property({ type: Boolean, reflect: true })\n public debug = false;\n\n @state()\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n @state()\n private stampContext: {\n view?: View;\n test?: unknown;\n activeTestpart?: unknown;\n activeSection?: unknown;\n activeItem?: unknown;\n } = {\n view: 'candidate',\n activeItem: {},\n activeSection: {\n items: []\n },\n activeTestpart: {\n items: []\n },\n test: {}\n };\n\n myTemplate: TemplateFunction;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n const templateElement = this.querySelector<HTMLTemplateElement>('template');\n if (!templateElement) {\n this.myTemplate = null;\n return;\n }\n this.myTemplate = prepareTemplate(templateElement);\n }\n\n protected willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) {\n this.stampContext = null;\n return;\n }\n const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);\n const activeSection = activeTestPart?.sections?.find(section => section.active);\n const activeItem = activeSection?.items.find(item => item.active);\n const { variables, ...augmentedItem } = activeItem || {};\n\n const augmentedTestPart = {\n ...activeTestPart,\n items: activeTestPart.sections.flatMap(section => section.items.map(({ variables, ...rest }) => rest)),\n sections: activeTestPart.sections.map(section => ({\n ...section,\n items: section.items.map(({ variables, ...rest }) => rest)\n }))\n };\n\n const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables, ...rest }) => rest) };\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n view: this.computedContext.view,\n activeItem: augmentedItem,\n activeSection: augmentedSection,\n activeTestpart: augmentedTestPart,\n test: activeTest\n };\n }\n\n render() {\n // if (!this.stampContext) return nothing;\n return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}\n ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-stamp': TestStamp;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,YAAY,eAAe;AAC1C,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,uBAAuB;AAChC,SAAS,eAAe;AAgBjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAML,SAAO,QAAQ;AAOf,SAAQ,eAMJ;AAAA,MACF,MAAM;AAAA,MACN,YAAY,CAAC;AAAA,MACb,eAAe;AAAA,QACb,OAAO,CAAC;AAAA,MACV;AAAA,MACA,gBAAgB;AAAA,QACd,OAAO,CAAC;AAAA,MACV;AAAA,MACA,MAAM,CAAC;AAAA,IACT;AAAA;AAAA,EAIU,mBAAmD;AAC3D,WAAO;AAAA,EACT;AAAA,EAEA,oBAA0B;AACxB,UAAM,kBAAkB;AACxB,UAAM,kBAAkB,KAAK,cAAmC,UAAU;AAC1E,QAAI,CAAC,iBAAiB;AACpB,WAAK,aAAa;AAClB;AAAA,IACF;AACA,SAAK,aAAa,gBAAgB,eAAe;AAAA,EACnD;AAAA,EAEU,WAAW,oBAA0C;AAC7D,QAAI,CAAC,KAAK,iBAAiB;AACzB,WAAK,eAAe;AACpB;AAAA,IACF;AACA,UAAM,iBAAiB,KAAK,gBAAgB,UAAU,KAAK,cAAY,SAAS,MAAM;AACtF,UAAM,gBAAgB,gBAAgB,UAAU,KAAK,aAAW,QAAQ,MAAM;AAC9E,UAAM,aAAa,eAAe,MAAM,KAAK,UAAQ,KAAK,MAAM;AAChE,UAAM,EAAE,WAAW,GAAG,cAAc,IAAI,cAAc,CAAC;AAEvD,UAAM,oBAAoB;AAAA,MACxB,GAAG;AAAA,MACH,OAAO,eAAe,SAAS,QAAQ,aAAW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
import {
|
|
9
|
+
__decorateClass
|
|
10
|
+
} from "./chunk-H2JE6IVU.js";
|
|
11
|
+
|
|
12
|
+
// src/lib/qti-test/components/test-next.ts
|
|
13
|
+
import { css, html, LitElement } from "lit";
|
|
14
|
+
import { customElement, property } from "lit/decorators.js";
|
|
15
|
+
import { consume } from "@lit/context";
|
|
16
|
+
var TestNext = class extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.disabled = false;
|
|
20
|
+
this._internals = this.attachInternals();
|
|
21
|
+
this._internals.role = "button";
|
|
22
|
+
this._internals.ariaLabel = "Next item";
|
|
23
|
+
this.addEventListener("click", (e) => {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
if (!this.disabled) this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
super.connectedCallback();
|
|
30
|
+
}
|
|
31
|
+
willUpdate(_changedProperties) {
|
|
32
|
+
if (!this.computedContext) return;
|
|
33
|
+
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
34
|
+
if (!testPart) return;
|
|
35
|
+
this.sectionItems = testPart.sections.flatMap((section) => section.items);
|
|
36
|
+
this.itemIndex = this.sectionItems.findIndex((item) => item.active);
|
|
37
|
+
this.checkDisabled();
|
|
38
|
+
}
|
|
39
|
+
checkDisabled() {
|
|
40
|
+
const shouldBeDisabled = !this.computedContext || this.itemIndex < 0 || this.itemIndex >= this.sectionItems?.length - 1;
|
|
41
|
+
console.log(shouldBeDisabled);
|
|
42
|
+
debugger;
|
|
43
|
+
if (this.disabled) {
|
|
44
|
+
this.disabled = true;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.disabled = shouldBeDisabled;
|
|
48
|
+
}
|
|
49
|
+
_requestItem(identifier) {
|
|
50
|
+
this.dispatchEvent(
|
|
51
|
+
new CustomEvent("qti-request-navigation", {
|
|
52
|
+
composed: true,
|
|
53
|
+
bubbles: true,
|
|
54
|
+
detail: {
|
|
55
|
+
type: "item",
|
|
56
|
+
id: identifier
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
return html`<slot></slot>`;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
// @watch('computedContext')
|
|
66
|
+
// _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {
|
|
67
|
+
// if (newValue) {
|
|
68
|
+
// this.disabled = false;
|
|
69
|
+
// }
|
|
70
|
+
// }
|
|
71
|
+
TestNext.styles = css`
|
|
72
|
+
:host {
|
|
73
|
+
${btn};
|
|
74
|
+
}
|
|
75
|
+
:host([disabled]) {
|
|
76
|
+
${dis};
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
__decorateClass([
|
|
80
|
+
property({ type: Boolean, reflect: true })
|
|
81
|
+
], TestNext.prototype, "disabled", 2);
|
|
82
|
+
__decorateClass([
|
|
83
|
+
consume({ context: computedContext, subscribe: true })
|
|
84
|
+
], TestNext.prototype, "computedContext", 2);
|
|
85
|
+
TestNext = __decorateClass([
|
|
86
|
+
customElement("test-next")
|
|
87
|
+
], TestNext);
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
TestNext
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=chunk-FZHYC3TU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-next.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport * as styles from './styles';\n// import { watch } from '../../decorators';\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedContext, ComputedItem } from '../../exports/computed.context';\n\n/**\n * Represents a custom element for navigating to the next test item.\n *\n * @remarks\n * This element provides functionality for navigating to the next test item.\n *\n * @example\n * ```html\n * <test-next></test-next>\n * ```\n */\n@customElement('test-next')\nexport class TestNext extends LitElement {\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n @consume({ context: computedContext, subscribe: true })\n protected computedContext: ComputedContext;\n\n sectionItems: ComputedItem[];\n itemIndex: number;\n\n // @watch('computedContext')\n // _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {\n // if (newValue) {\n // this.disabled = false;\n // }\n // }\n\n static styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n private _internals: ElementInternals;\n\n constructor() {\n super();\n\n this._internals = this.attachInternals();\n this._internals.role = 'button';\n this._internals.ariaLabel = 'Next item';\n\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this.disabled) this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);\n });\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n }\n\n willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n if (!this.computedContext) return;\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n if (!testPart) return;\n this.sectionItems = testPart.sections.flatMap(section => section.items);\n this.itemIndex = this.sectionItems.findIndex(item => item.active);\n this.checkDisabled();\n }\n\n checkDisabled() {\n const shouldBeDisabled =\n !this.computedContext || this.itemIndex < 0 || this.itemIndex >= this.sectionItems?.length - 1;\n console.log(shouldBeDisabled);\n debugger;\n if (this.disabled) {\n this.disabled = true;\n return;\n }\n this.disabled = shouldBeDisabled;\n }\n\n protected _requestItem(identifier: string): void {\n this.dispatchEvent(\n new CustomEvent('qti-request-navigation', {\n composed: true,\n bubbles: true,\n detail: {\n type: 'item',\n id: identifier\n }\n })\n );\n }\n\n render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-next': TestNext;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,kBAAkB;AACtC,SAAS,eAAe,gBAAgB;AACxC,SAAS,eAAe;AAoBjB,IAAM,WAAN,c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AA;AAAA,QAGH,GAAG;AAAA;AAAA;AApBT;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAD/B,SAEJ;AAGG;AAAA,EADT,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAJ3C,SAKD;AALC,WAAN;AAAA,EADN,cAAc,WAAW;AAAA,GACb;","names":["testPart"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {
|
|
2
|
+
btn,
|
|
3
|
+
dis
|
|
4
|
+
} from "./chunk-5ZHHNEDA.js";
|
|
5
|
+
import {
|
|
6
|
+
computedContext
|
|
7
|
+
} from "./chunk-AZIKAG7K.js";
|
|
8
|
+
import {
|
|
9
|
+
__decorateClass
|
|
10
|
+
} from "./chunk-H2JE6IVU.js";
|
|
11
|
+
|
|
12
|
+
// src/lib/qti-test/components/test-next.ts
|
|
13
|
+
import { css, html, LitElement } from "lit";
|
|
14
|
+
import { customElement, property } from "lit/decorators.js";
|
|
15
|
+
import { consume } from "@lit/context";
|
|
16
|
+
var TestNext = class extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.disabled = false;
|
|
20
|
+
this._internals = this.attachInternals();
|
|
21
|
+
this._internals.role = "button";
|
|
22
|
+
this._internals.ariaLabel = "Next item";
|
|
23
|
+
this.addEventListener("click", (e) => {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
if (!this.disabled) this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
attributeChangedCallback(name, _old, value) {
|
|
29
|
+
console.log(name, value);
|
|
30
|
+
}
|
|
31
|
+
willUpdate(_changedProperties) {
|
|
32
|
+
if (!this.computedContext) return;
|
|
33
|
+
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
34
|
+
if (!testPart) return;
|
|
35
|
+
this.sectionItems = testPart.sections.flatMap((section) => section.items);
|
|
36
|
+
this.itemIndex = this.sectionItems.findIndex((item) => item.active);
|
|
37
|
+
this.checkDisabled();
|
|
38
|
+
}
|
|
39
|
+
checkDisabled() {
|
|
40
|
+
const shouldBeDisabled = !this.computedContext || this.itemIndex < 0 || this.itemIndex >= this.sectionItems?.length - 1;
|
|
41
|
+
console.log(shouldBeDisabled);
|
|
42
|
+
if (this.disabled) {
|
|
43
|
+
this.disabled = true;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.disabled = shouldBeDisabled;
|
|
47
|
+
}
|
|
48
|
+
_requestItem(identifier) {
|
|
49
|
+
this.dispatchEvent(
|
|
50
|
+
new CustomEvent("qti-request-navigation", {
|
|
51
|
+
composed: true,
|
|
52
|
+
bubbles: true,
|
|
53
|
+
detail: {
|
|
54
|
+
type: "item",
|
|
55
|
+
id: identifier
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
render() {
|
|
61
|
+
return html`<slot></slot>`;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
TestNext.styles = css`
|
|
65
|
+
:host {
|
|
66
|
+
${btn};
|
|
67
|
+
}
|
|
68
|
+
:host([disabled]) {
|
|
69
|
+
${dis};
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
__decorateClass([
|
|
73
|
+
property({ type: Boolean, reflect: true })
|
|
74
|
+
], TestNext.prototype, "disabled", 2);
|
|
75
|
+
__decorateClass([
|
|
76
|
+
consume({ context: computedContext, subscribe: true })
|
|
77
|
+
], TestNext.prototype, "computedContext", 2);
|
|
78
|
+
TestNext = __decorateClass([
|
|
79
|
+
customElement("test-next")
|
|
80
|
+
], TestNext);
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
TestNext
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=chunk-GDNPYP37.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-next.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport * as styles from './styles';\n// import { watch } from '../../decorators';\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedContext, ComputedItem } from '../../exports/computed.context';\n\n/**\n * Represents a custom element for navigating to the next test item.\n *\n * @remarks\n * This element provides functionality for navigating to the next test item.\n *\n * @example\n * ```html\n * <test-next></test-next>\n * ```\n */\n@customElement('test-next')\nexport class TestNext extends LitElement {\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n @consume({ context: computedContext, subscribe: true })\n protected computedContext: ComputedContext;\n\n sectionItems: ComputedItem[];\n itemIndex: number;\n\n static styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n private _internals: ElementInternals;\n\n constructor() {\n super();\n\n this._internals = this.attachInternals();\n this._internals.role = 'button';\n this._internals.ariaLabel = 'Next item';\n\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this.disabled) this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);\n });\n }\n\n attributeChangedCallback(name: string, _old: string | null, value: string | null): void {\n console.log(name, value);\n }\n\n willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n if (!this.computedContext) return;\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n if (!testPart) return;\n this.sectionItems = testPart.sections.flatMap(section => section.items);\n this.itemIndex = this.sectionItems.findIndex(item => item.active);\n this.checkDisabled();\n }\n\n checkDisabled() {\n const shouldBeDisabled =\n !this.computedContext || this.itemIndex < 0 || this.itemIndex >= this.sectionItems?.length - 1;\n console.log(shouldBeDisabled);\n\n if (this.disabled) {\n this.disabled = true;\n return;\n }\n this.disabled = shouldBeDisabled;\n }\n\n protected _requestItem(identifier: string): void {\n this.dispatchEvent(\n new CustomEvent('qti-request-navigation', {\n composed: true,\n bubbles: true,\n detail: {\n type: 'item',\n id: identifier\n }\n })\n );\n }\n\n render() {\n return html`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AQ;AAAA,UACN,MAAM;AAAA,UACN,IAAI;AAAA,QACN;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,EACT;AACF;AA1Ea,SAUJ,SAAS;AAAA;AAAA,QAEH,GAAG;AAAA;AAAA;AAAA,QAGH,GAAG;AAAA;AAAA;AAbT;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAD/B,SAEJ;AAGG;AAAA,EADT,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAJ3C,SAKD;AALC,WAAN;AAAA,EADN,cAAc,WAAW;AAAA,GACb;","names":["testPart"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computedContext
|
|
3
|
+
} from "./chunk-AZIKAG7K.js";
|
|
4
|
+
import {
|
|
5
|
+
__decorateClass
|
|
6
|
+
} from "./chunk-H2JE6IVU.js";
|
|
7
|
+
|
|
8
|
+
// src/lib/qti-test/components/test-stamp.ts
|
|
9
|
+
import { html, LitElement, nothing } from "lit";
|
|
10
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
11
|
+
import { prepareTemplate } from "stampino";
|
|
12
|
+
import { consume } from "@lit/context";
|
|
13
|
+
var TestStamp = class extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.debug = false;
|
|
17
|
+
this.stampContext = {
|
|
18
|
+
view: "candidate",
|
|
19
|
+
activeItem: {},
|
|
20
|
+
activeSection: {
|
|
21
|
+
items: []
|
|
22
|
+
},
|
|
23
|
+
activeTestpart: {
|
|
24
|
+
items: []
|
|
25
|
+
},
|
|
26
|
+
test: {}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
createRenderRoot() {
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
super.connectedCallback();
|
|
34
|
+
const templateElement = this.querySelector("template");
|
|
35
|
+
if (!templateElement) {
|
|
36
|
+
this.myTemplate = null;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this.myTemplate = prepareTemplate(templateElement);
|
|
40
|
+
}
|
|
41
|
+
willUpdate(_changedProperties) {
|
|
42
|
+
if (!this.computedContext) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const activeTestPart = this.computedContext.testParts.find((testPart) => testPart.active);
|
|
46
|
+
const activeSection = activeTestPart?.sections.find((section) => section.active);
|
|
47
|
+
const activeItem = activeSection?.items.find((item) => item.active);
|
|
48
|
+
const { variables, ...augmentedItem } = activeItem || {};
|
|
49
|
+
const augmentedTestPart = {
|
|
50
|
+
...activeTestPart,
|
|
51
|
+
items: activeTestPart.sections.flatMap((section) => section.items.map(({ variables: variables2, ...rest }) => rest)),
|
|
52
|
+
sections: activeTestPart.sections.map((section) => ({
|
|
53
|
+
...section,
|
|
54
|
+
items: section.items.map(({ variables: variables2, ...rest }) => rest)
|
|
55
|
+
}))
|
|
56
|
+
};
|
|
57
|
+
console.log("activeTestPart", activeTestPart);
|
|
58
|
+
const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables: variables2, ...rest }) => rest) };
|
|
59
|
+
const { testParts, ...activeTest } = this.computedContext;
|
|
60
|
+
this.stampContext = {
|
|
61
|
+
view: this.computedContext.view,
|
|
62
|
+
activeItem: augmentedItem,
|
|
63
|
+
activeSection: augmentedSection,
|
|
64
|
+
activeTestpart: augmentedTestPart,
|
|
65
|
+
test: activeTest
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
|
|
70
|
+
${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
__decorateClass([
|
|
74
|
+
property({ type: Boolean, reflect: true })
|
|
75
|
+
], TestStamp.prototype, "debug", 2);
|
|
76
|
+
__decorateClass([
|
|
77
|
+
state(),
|
|
78
|
+
consume({ context: computedContext, subscribe: true })
|
|
79
|
+
], TestStamp.prototype, "computedContext", 2);
|
|
80
|
+
__decorateClass([
|
|
81
|
+
state()
|
|
82
|
+
], TestStamp.prototype, "stampContext", 2);
|
|
83
|
+
TestStamp = __decorateClass([
|
|
84
|
+
customElement("test-stamp")
|
|
85
|
+
], TestStamp);
|
|
86
|
+
|
|
87
|
+
export {
|
|
88
|
+
TestStamp
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=chunk-H2HBYOZZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-stamp.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { prepareTemplate } from 'stampino';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { View } from '../core/mixins/test-view.mixin';\nimport type { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n/**\n * A custom web component that renders a test stamp using the Lit framework.\n * This component is deprecated and will be removed in the future.\n * @customElement\n * @extends {LitElement}\n */\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\n /**\n * Indicates whether the component is in debug mode.\n * When set to `true`, the available objects and properties (i.e.: stampContext) is displayed.\n */\n @property({ type: Boolean, reflect: true })\n public debug = false;\n\n @state()\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n @state()\n private stampContext: {\n view?: View;\n test?: unknown;\n activeTestpart?: unknown;\n activeSection?: unknown;\n activeItem?: unknown;\n } = {\n view: 'candidate',\n activeItem: {},\n activeSection: {\n items: []\n },\n activeTestpart: {\n items: []\n },\n test: {}\n };\n\n myTemplate: TemplateFunction;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n const templateElement = this.querySelector<HTMLTemplateElement>('template');\n if (!templateElement) {\n this.myTemplate = null;\n return;\n }\n this.myTemplate = prepareTemplate(templateElement);\n }\n\n protected willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) {\n return;\n }\n const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);\n const activeSection = activeTestPart?.sections.find(section => section.active);\n const activeItem = activeSection?.items.find(item => item.active);\n const { variables, ...augmentedItem } = activeItem || {};\n\n const augmentedTestPart = {\n ...activeTestPart,\n items: activeTestPart.sections.flatMap(section => section.items.map(({ variables, ...rest }) => rest)),\n sections: activeTestPart.sections.map(section => ({\n ...section,\n items: section.items.map(({ variables, ...rest }) => rest)\n }))\n };\n\n console.log('activeTestPart', activeTestPart);\n\n const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables, ...rest }) => rest) };\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n view: this.computedContext.view,\n activeItem: augmentedItem,\n activeSection: augmentedSection,\n activeTestpart: augmentedTestPart,\n test: activeTest\n };\n }\n\n render() {\n // if (!this.stampContext) return nothing;\n return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}\n ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-stamp': TestStamp;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,YAAY,eAAe;AAC1C,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,uBAAuB;AAChC,SAAS,eAAe;AAgBjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAML,SAAO,QAAQ;AAOf,SAAQ,eAMJ;AAAA,MACF,MAAM;AAAA,MACN,YAAY,CAAC;AAAA,MACb,eAAe;AAAA,QACb,OAAO,CAAC;AAAA,MACV;AAAA,MACA,gBAAgB;AAAA,QACd,OAAO,CAAC;AAAA,MACV;A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