@citolab/qti-components 7.3.5 → 7.3.7

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.
Files changed (142) hide show
  1. package/cdn/chunks/chunk-2VU43EIZ.js +8 -0
  2. package/cdn/chunks/chunk-2WJEB7LD.js +1 -0
  3. package/cdn/chunks/chunk-34G25RYG.js +8 -0
  4. package/cdn/chunks/chunk-7543U7PC.js +1 -0
  5. package/cdn/chunks/chunk-A73O6JDN.js +5 -0
  6. package/cdn/chunks/chunk-AV6ISYP4.js +41 -0
  7. package/cdn/chunks/chunk-AYRVSFDB.js +1 -0
  8. package/cdn/chunks/chunk-BJRPEBBQ.js +1 -0
  9. package/cdn/chunks/chunk-C3UTBQLI.js +8 -0
  10. package/cdn/chunks/chunk-CHA2MSUC.js +1 -0
  11. package/cdn/chunks/chunk-D5X3UG54.js +1 -0
  12. package/cdn/chunks/chunk-DS3TJWSG.js +8 -0
  13. package/cdn/chunks/chunk-FTIKZVQS.js +0 -0
  14. package/cdn/chunks/chunk-GHYJJLM6.js +5 -0
  15. package/cdn/chunks/chunk-H5VQY4UD.js +1 -0
  16. package/cdn/chunks/chunk-IYTC7IL7.js +48 -0
  17. package/cdn/chunks/chunk-JB5OTSUJ.js +1 -0
  18. package/cdn/chunks/chunk-JR322KXH.js +1 -0
  19. package/cdn/chunks/chunk-JYB6NVDN.js +1 -0
  20. package/cdn/chunks/chunk-LXJSKVMQ.js +6 -0
  21. package/cdn/chunks/chunk-NN2AW26H.js +5 -0
  22. package/cdn/chunks/chunk-ONSO5XEG.js +1464 -0
  23. package/cdn/chunks/chunk-PMW5NIBL.js +8 -0
  24. package/cdn/chunks/chunk-Q54YYIH7.js +8 -0
  25. package/cdn/chunks/chunk-QIEEN6C7.js +8 -0
  26. package/cdn/chunks/chunk-RALUW4CJ.js +5 -0
  27. package/cdn/chunks/chunk-RTHQAQWR.js +2 -0
  28. package/cdn/chunks/chunk-SB62LFF7.js +10 -0
  29. package/cdn/chunks/chunk-TI7HI3OS.js +1464 -0
  30. package/cdn/chunks/chunk-VWTYL7A3.js +48 -0
  31. package/cdn/chunks/chunk-W4QXZT2Y.js +8 -0
  32. package/cdn/chunks/chunk-YNBLRM6A.js +1 -0
  33. package/cdn/chunks/chunk-ZPQBCZQ2.js +3589 -0
  34. package/cdn/exports/computed-item.context.js +1 -1
  35. package/cdn/exports/computed.context.js +1 -1
  36. package/cdn/exports/config.context.js +1 -1
  37. package/cdn/exports/interaction.js +1 -1
  38. package/cdn/exports/item.context.js +1 -1
  39. package/cdn/exports/qti-assessment-item.context.js +1 -1
  40. package/cdn/exports/qti-condition-expression.js +1 -1
  41. package/cdn/exports/qti-expression.js +1 -1
  42. package/cdn/exports/session.context.js +1 -1
  43. package/cdn/exports/test.context.js +1 -1
  44. package/cdn/index.global.js +1 -1
  45. package/cdn/index.js +1 -1
  46. package/cdn/qti-components/index.js +1 -1
  47. package/cdn/qti-item/components/item-container.js +1 -1
  48. package/cdn/qti-item/components/item-show-correct-response.js +1 -1
  49. package/cdn/qti-item/components/print-item-variables.js +1 -1
  50. package/cdn/qti-item/components/styles.js +1 -1
  51. package/cdn/qti-item/core/index.js +1 -1
  52. package/cdn/qti-loader/index.js +1 -1
  53. package/cdn/qti-test/components/index.js +1 -1
  54. package/cdn/qti-test/components/styles.js +1 -1
  55. package/cdn/qti-test/components/test-check-item.js +1 -1
  56. package/cdn/qti-test/components/test-container.js +1 -1
  57. package/cdn/qti-test/components/test-end-attempt.js +1 -1
  58. package/cdn/qti-test/components/test-item-link.js +1 -1
  59. package/cdn/qti-test/components/test-navigation.js +1 -1
  60. package/cdn/qti-test/components/test-next.js +1 -1
  61. package/cdn/qti-test/components/test-paging-buttons-stamp.js +1 -1
  62. package/cdn/qti-test/components/test-prev.js +1 -1
  63. package/cdn/qti-test/components/test-print-context.js +1 -1
  64. package/cdn/qti-test/components/test-print-item-variables.js +1 -1
  65. package/cdn/qti-test/components/test-scoring-buttons.js +1 -1
  66. package/cdn/qti-test/components/test-scoring-feedback.js +1 -1
  67. package/cdn/qti-test/components/test-section-buttons-stamp.js +1 -1
  68. package/cdn/qti-test/components/test-section-link.js +1 -1
  69. package/cdn/qti-test/components/test-show-correct-response.js +1 -1
  70. package/cdn/qti-test/components/test-stamp.js +1 -1
  71. package/cdn/qti-test/components/test-view-toggle.js +1 -1
  72. package/cdn/qti-test/components/test-view.js +1 -1
  73. package/cdn/qti-test/core/index.js +1 -1
  74. package/cdn/qti-transformers/index.js +1 -1
  75. package/dist/chunks/chunk-3TX2EBTU.js +94 -0
  76. package/dist/chunks/chunk-3TX2EBTU.js.map +1 -0
  77. package/dist/chunks/chunk-7K44TDQO.js +91 -0
  78. package/dist/chunks/chunk-7K44TDQO.js.map +1 -0
  79. package/dist/chunks/chunk-AZJR5HSV.js +7960 -0
  80. package/dist/chunks/chunk-AZJR5HSV.js.map +1 -0
  81. package/dist/chunks/chunk-B3C3IFYR.js +7960 -0
  82. package/dist/chunks/chunk-B3C3IFYR.js.map +1 -0
  83. package/dist/chunks/chunk-BV2QSR2N.js +3 -0
  84. package/dist/chunks/chunk-BV2QSR2N.js.map +1 -0
  85. package/dist/chunks/chunk-CP34TICQ.js +45 -0
  86. package/dist/chunks/chunk-CP34TICQ.js.map +1 -0
  87. package/dist/chunks/chunk-EMVOKXSA.js +84 -0
  88. package/dist/chunks/chunk-EMVOKXSA.js.map +1 -0
  89. package/dist/chunks/chunk-GAHXUFMQ.js +93 -0
  90. package/dist/chunks/chunk-GAHXUFMQ.js.map +1 -0
  91. package/dist/chunks/chunk-GRQYHS5X.js +269 -0
  92. package/dist/chunks/chunk-GRQYHS5X.js.map +1 -0
  93. package/dist/chunks/chunk-KSXNC564.js +43 -0
  94. package/dist/chunks/chunk-KSXNC564.js.map +1 -0
  95. package/dist/chunks/chunk-LNL2LY75.js +94 -0
  96. package/dist/chunks/chunk-LNL2LY75.js.map +1 -0
  97. package/dist/chunks/chunk-NBCXOMMU.js +887 -0
  98. package/dist/chunks/chunk-NBCXOMMU.js.map +1 -0
  99. package/dist/chunks/chunk-NJ26K2SA.js +3579 -0
  100. package/dist/chunks/chunk-NJ26K2SA.js.map +1 -0
  101. package/dist/chunks/chunk-TUKEQ36K.js +60 -0
  102. package/dist/chunks/chunk-TUKEQ36K.js.map +1 -0
  103. package/dist/chunks/chunk-VVXIAK5M.js +82 -0
  104. package/dist/chunks/chunk-VVXIAK5M.js.map +1 -0
  105. package/dist/chunks/chunk-YKLITOZB.js +887 -0
  106. package/dist/chunks/chunk-YKLITOZB.js.map +1 -0
  107. package/dist/exports/computed.context.d.ts +2 -2
  108. package/dist/exports/session.context.d.ts +2 -2
  109. package/dist/index.d.ts +2 -2
  110. package/dist/index.js +15 -13
  111. package/dist/item.css +0 -3
  112. package/dist/qti-components/index.js +2 -1
  113. package/dist/qti-components-jsx.d.ts +4 -8
  114. package/dist/qti-item/components/item-container.js +2 -2
  115. package/dist/qti-item/core/index.js +2 -2
  116. package/dist/qti-test/components/index.d.ts +2 -2
  117. package/dist/qti-test/components/index.js +12 -10
  118. package/dist/qti-test/components/test-container.js +2 -2
  119. package/dist/qti-test/components/test-navigation.d.ts +2 -2
  120. package/dist/qti-test/components/test-navigation.js +1 -1
  121. package/dist/qti-test/components/test-next.d.ts +18 -15
  122. package/dist/qti-test/components/test-next.js +4 -1
  123. package/dist/qti-test/components/test-paging-buttons-stamp.d.ts +1 -1
  124. package/dist/qti-test/components/test-paging-buttons-stamp.js +1 -1
  125. package/dist/qti-test/components/test-prev.d.ts +19 -18
  126. package/dist/qti-test/components/test-prev.js +4 -1
  127. package/dist/qti-test/components/test-print-context.d.ts +2 -2
  128. package/dist/qti-test/components/test-print-item-variables.d.ts +2 -2
  129. package/dist/qti-test/components/test-scoring-buttons.d.ts +2 -2
  130. package/dist/qti-test/components/test-scoring-buttons.js +1 -1
  131. package/dist/qti-test/components/test-scoring-feedback.d.ts +2 -2
  132. package/dist/qti-test/components/test-section-buttons-stamp.d.ts +1 -1
  133. package/dist/qti-test/components/test-section-buttons-stamp.js +1 -1
  134. package/dist/qti-test/components/test-show-correct-response.d.ts +2 -2
  135. package/dist/qti-test/components/test-stamp.d.ts +1 -1
  136. package/dist/qti-test/components/test-stamp.js +1 -1
  137. package/dist/qti-test/components/test-view-toggle.js +1 -1
  138. package/dist/qti-test/core/index.d.ts +3 -3
  139. package/dist/qti-test/core/index.js +3 -2
  140. package/dist/qti-test-feedback-DCZDtUuH.d.ts +85 -0
  141. package/dist/vscode.html-custom-data.json +4 -16
  142. package/package.json +3 -3
@@ -0,0 +1,3 @@
1
+ // src/lib/decorators/prop-internal-state.ts
2
+ import { property } from "lit/decorators.js";
3
+ //# sourceMappingURL=chunk-BV2QSR2N.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/decorators/prop-internal-state.ts"],"sourcesContent":["import { property } from 'lit/decorators.js';\n\nimport type { ReactiveElement } from 'lit';\nimport type { PropertyDeclaration } from 'lit';\n\n// Extended decorator options\ninterface InternalStateOptions extends PropertyDeclaration {\n aria?: string; // Corresponding ARIA attribute, e.g., 'aria-disabled'\n}\n\nexport function propInternalState(options: InternalStateOptions) {\n return (protoOrDescriptor: any, name: string) => {\n // Apply the default Lit `@property` decorator\n property(options)(protoOrDescriptor, name);\n\n // Intercept the property descriptor to enhance functionality\n const key = `__${name}`; // Internal backing field\n\n Object.defineProperty(protoOrDescriptor, name, {\n get() {\n return this[key];\n },\n set(value: any) {\n const oldValue = this[key];\n this[key] = value;\n\n // Trigger updates if value changes\n if (oldValue !== value) {\n // Update internals state\n if (this._internals?.states) {\n const stateName = name.toLowerCase();\n if (value) {\n this._internals.states.add(`--${stateName}`);\n } else {\n this._internals.states.delete(`--${stateName}`);\n }\n }\n\n // Update ARIA attributes if specified\n if (options.aria && this._internals) {\n const ariaAttribute = options.aria;\n if (value) {\n this._internals[ariaAttribute] = 'true';\n } else {\n this._internals[ariaAttribute] = null;\n }\n }\n\n // Request an update\n (this as ReactiveElement).requestUpdate(name, oldValue);\n }\n },\n configurable: true,\n enumerable: true\n });\n };\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;","names":[]}
@@ -0,0 +1,45 @@
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-paging-buttons-stamp.ts
9
+ import { html, LitElement } from "lit";
10
+ import { customElement } from "lit/decorators.js";
11
+ import { prepareTemplate } from "@heximal/templates";
12
+ import { consume } from "@lit/context";
13
+ var TestPagingButtonsStamp = class extends LitElement {
14
+ createRenderRoot() {
15
+ return this;
16
+ }
17
+ constructor() {
18
+ super();
19
+ this._internals = this.attachInternals();
20
+ this._internals.ariaLabel = "pagination";
21
+ }
22
+ connectedCallback() {
23
+ super.connectedCallback();
24
+ const templateElement = this.querySelector("template");
25
+ this.myTemplate = prepareTemplate(templateElement);
26
+ }
27
+ render() {
28
+ if (!this.computedContext) return html``;
29
+ const items = this.computedContext.testParts.flatMap(
30
+ (testPart) => testPart.sections.flatMap((section) => section.items)
31
+ );
32
+ return html` ${items.map((item) => this.myTemplate({ item, view: this.computedContext.view }))} `;
33
+ }
34
+ };
35
+ __decorateClass([
36
+ consume({ context: computedContext, subscribe: true })
37
+ ], TestPagingButtonsStamp.prototype, "computedContext", 2);
38
+ TestPagingButtonsStamp = __decorateClass([
39
+ customElement("test-paging-buttons-stamp")
40
+ ], TestPagingButtonsStamp);
41
+
42
+ export {
43
+ TestPagingButtonsStamp
44
+ };
45
+ //# sourceMappingURL=chunk-CP34TICQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-paging-buttons-stamp.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { prepareTemplate } from '@heximal/templates';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from '@heximal/templates';\n\n/**\n * @deprecated test-paging-buttons-stamp is deprecated and will be removed in the future.\n */\n@customElement('test-paging-buttons-stamp')\nexport class TestPagingButtonsStamp extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n myTemplate: TemplateFunction;\n private _internals: ElementInternals;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n this._internals.ariaLabel = 'pagination';\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n const templateElement = this.querySelector<HTMLTemplateElement>('template');\n this.myTemplate = prepareTemplate(templateElement);\n }\n\n render() {\n if (!this.computedContext) return html``;\n const items = this.computedContext.testParts.flatMap(testPart =>\n testPart.sections.flatMap(section => section.items)\n );\n\n return html` ${items.map(item => this.myTemplate({ item, view: this.computedContext.view }))} `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-paging-buttons-stamp': TestPagingButtonsStamp;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,kBAAkB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,eAAe;AAWjB,IAAM,yBAAN,cAAqC,WAAW;AAAA,EAO3C,mBAAmD;AAC3D,WAAO;AAAA,EACT;AAAA,EAEA,cAAc;AACZ,UAAM;AACN,SAAK,aAAa,KAAK,gBAAgB;AACvC,SAAK,WAAW,YAAY;AAAA,EAC9B;AAAA,EAEA,oBAA0B;AACxB,UAAM,kBAAkB;AACxB,UAAM,kBAAkB,KAAK,cAAmC,UAAU;AAC1E,SAAK,aAAa,gBAAgB,eAAe;AAAA,EACnD;AAAA,EAEA,SAAS;AACP,QAAI,CAAC,KAAK,gBAAiB,QAAO;AAClC,UAAM,QAAQ,KAAK,gBAAgB,UAAU;AAAA,MAAQ,cACnD,SAAS,SAAS,QAAQ,aAAW,QAAQ,KAAK;AAAA,IACpD;AAEA,WAAO,QAAQ,MAAM,IAAI,UAAQ,KAAK,WAAW,EAAE,MAAM,MAAM,KAAK,gBAAgB,KAAK,CAAC,CAAC,CAAC;AAAA,EAC9F;AACF;AA7BU;AAAA,EADP,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAD3C,uBAEH;AAFG,yBAAN;AAAA,EADN,cAAc,2BAA2B;AAAA,GAC7B;","names":[]}
@@ -0,0 +1,84 @@
1
+ import {
2
+ btn,
3
+ dis
4
+ } from "./chunk-5ZHHNEDA.js";
5
+ import {
6
+ watch
7
+ } from "./chunk-ELDMXTUQ.js";
8
+ import {
9
+ computedContext
10
+ } from "./chunk-AZIKAG7K.js";
11
+ import {
12
+ __decorateClass
13
+ } from "./chunk-H2JE6IVU.js";
14
+
15
+ // src/lib/qti-test/components/test-prev.ts
16
+ import { css, html, LitElement } from "lit";
17
+ import { customElement, property } from "lit/decorators.js";
18
+ import { consume } from "@lit/context";
19
+ var TestPrev = class extends LitElement {
20
+ constructor() {
21
+ super();
22
+ this._internalDisabled = true;
23
+ this.addEventListener("click", (e) => {
24
+ e.preventDefault();
25
+ if (!this._internalDisabled) this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);
26
+ });
27
+ }
28
+ _handleTestElementChange(_oldValue, newValue) {
29
+ if (newValue) {
30
+ this._internalDisabled = false;
31
+ }
32
+ }
33
+ willUpdate(_changedProperties) {
34
+ if (!this.computedContext) return;
35
+ const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
36
+ if (!testPart) return;
37
+ this.sectionItems = testPart.sections.flatMap((section) => section.items);
38
+ this.itemIndex = this.sectionItems.findIndex((item) => item.active);
39
+ this.checkDisabled();
40
+ }
41
+ checkDisabled() {
42
+ this._internalDisabled = !this.computedContext || this.itemIndex === 0 || this.itemIndex === -1;
43
+ }
44
+ _requestItem(identifier) {
45
+ this.dispatchEvent(
46
+ new CustomEvent("qti-request-navigation", {
47
+ composed: true,
48
+ bubbles: true,
49
+ detail: {
50
+ type: "item",
51
+ id: identifier
52
+ }
53
+ })
54
+ );
55
+ }
56
+ render() {
57
+ return html`<slot></slot>`;
58
+ }
59
+ };
60
+ TestPrev.styles = css`
61
+ :host {
62
+ ${btn};
63
+ }
64
+ :host([disabled]) {
65
+ ${dis};
66
+ }
67
+ `;
68
+ __decorateClass([
69
+ property({ type: Boolean, reflect: true, attribute: "disabled" })
70
+ ], TestPrev.prototype, "_internalDisabled", 2);
71
+ __decorateClass([
72
+ consume({ context: computedContext, subscribe: true })
73
+ ], TestPrev.prototype, "computedContext", 2);
74
+ __decorateClass([
75
+ watch("computedContext")
76
+ ], TestPrev.prototype, "_handleTestElementChange", 1);
77
+ TestPrev = __decorateClass([
78
+ customElement("test-prev")
79
+ ], TestPrev);
80
+
81
+ export {
82
+ TestPrev
83
+ };
84
+ //# sourceMappingURL=chunk-EMVOKXSA.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 } 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/**\n * Represents a custom element for navigating to the previous test item.\n *\n * @remarks\n * This element provides functionality for navigating to the previous test item.\n *\n * @example\n * ```html\n * <test-prev></test-prev>\n * ```\n */\n@customElement('test-prev')\nexport class TestPrev extends LitElement {\n @property({ type: Boolean, reflect: true, attribute: 'disabled' })\n public _internalDisabled = true;\n\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n sectionItems: ComputedItem[];\n itemIndex: number;\n\n @watch('computedContext')\n _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {\n if (newValue) {\n this._internalDisabled = false;\n }\n }\n\n static styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n constructor() {\n super();\n\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this._internalDisabled) this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);\n });\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 this._internalDisabled = !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-previous': TestPrev;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,kBAAkB;AACtC,SAAS,eAAe,gBAAgB;AACxC,SAAS,eAAe;AAoBjB,IAAM,WAAN,cAAuB,WAAW;AAAA,EA0BvC,cAAc;AACZ,UAAM;AAzBR,SAAO,oBAAoB;AA2BzB,SAAK,iBAAiB,SAAS,OAAK;AAClC,QAAE,eAAe;AACjB,UAAI,CAAC,KAAK,kBAAmB,MAAK,aAAa,KAAK,aAAa,KAAK,YAAY,CAAC,EAAE,UAAU;AAAA,IACjG,CAAC;AAAA,EACH;AAAA,EAtBA,yBAAyB,WAA4B,UAA2B;AAC9E,QAAI,UAAU;AACZ,WAAK,oBAAoB;AAAA,IAC3B;AAAA,EACF;AAAA,EAoBA,WAAW,oBAA4D;AACrE,QAAI,CAAC,KAAK,gBAAiB;AAC3B,UAAM,WAAW,KAAK,iBAAiB,UAAU,KAAK,CAAAA,cAAYA,UAAS,MAAM;AACjF,QAAI,CAAC,SAAU;AACf,SAAK,eAAe,SAAS,SAAS,QAAQ,aAAW,QAAQ,KAAK;AACtE,SAAK,YAAY,KAAK,aAAa,UAAU,UAAQ,KAAK,MAAM;AAChE,SAAK,cAAc;AAAA,EACrB;AAAA,EAEA,gBAAgB;AACd,SAAK,oBAAoB,CAAC,KAAK,mBAAmB,KAAK,cAAc,KAAK,KAAK,cAAc;AAAA,EAC/F;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;AAhEa,SAiBJ,SAAS;AAAA;AAAA,QAEH,GAAG;AAAA;AAAA;AAAA,QAGH,GAAG;AAAA;AAAA;AApBT;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,WAAW,CAAC;AAAA,GADtD,SAEJ;AAGC;AAAA,EADP,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAJ3C,SAKH;AAMR;AAAA,EADC,MAAM,iBAAiB;AAAA,GAVb,SAWX;AAXW,WAAN;AAAA,EADN,cAAc,WAAW;AAAA,GACb;","names":["testPart"]}
@@ -0,0 +1,93 @@
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 "@heximal/templates";
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
+ sections: []
26
+ },
27
+ test: {}
28
+ };
29
+ }
30
+ createRenderRoot() {
31
+ return this;
32
+ }
33
+ connectedCallback() {
34
+ super.connectedCallback();
35
+ const templateElement = this.querySelector("template");
36
+ if (!templateElement) {
37
+ this.myTemplate = null;
38
+ return;
39
+ }
40
+ this.myTemplate = prepareTemplate(templateElement);
41
+ }
42
+ willUpdate(_changedProperties) {
43
+ if (!this.computedContext) {
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
+ if (!activeTestPart || !activeSection || !activeItem) {
51
+ return;
52
+ }
53
+ const augmentedTestPart = {
54
+ ...activeTestPart,
55
+ items: activeTestPart.sections.flatMap((section) => section.items.map(({ variables: variables2, ...rest }) => rest)),
56
+ sections: activeTestPart.sections.map((section) => ({
57
+ ...section,
58
+ items: section.items.map(({ variables: variables2, ...rest }) => rest)
59
+ }))
60
+ };
61
+ const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables: variables2, ...rest }) => rest) };
62
+ const { testParts, ...activeTest } = this.computedContext;
63
+ this.stampContext = {
64
+ view: this.computedContext.view,
65
+ activeItem: augmentedItem,
66
+ activeSection: augmentedSection,
67
+ activeTestpart: augmentedTestPart,
68
+ test: activeTest
69
+ };
70
+ }
71
+ render() {
72
+ return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
73
+ ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
74
+ }
75
+ };
76
+ __decorateClass([
77
+ property({ type: Boolean, reflect: true })
78
+ ], TestStamp.prototype, "debug", 2);
79
+ __decorateClass([
80
+ state(),
81
+ consume({ context: computedContext, subscribe: true })
82
+ ], TestStamp.prototype, "computedContext", 2);
83
+ __decorateClass([
84
+ state()
85
+ ], TestStamp.prototype, "stampContext", 2);
86
+ TestStamp = __decorateClass([
87
+ customElement("test-stamp")
88
+ ], TestStamp);
89
+
90
+ export {
91
+ TestStamp
92
+ };
93
+ //# sourceMappingURL=chunk-GAHXUFMQ.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 '@heximal/templates';\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 '@heximal/templates';\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 sections: []\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 if (!activeTestPart || !activeSection || !activeItem) {\n return;\n }\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,QACR,UAAU,CAAC;AAAA,MACb;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;AACp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KAAK,aAAa,KAAK,WAAW,KAAK,YAAY,IAAI,OAAO;AAAA,EAClE;AACF;AAjFS;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAL/B,UAMJ;AAIC;AAAA,EAFP,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAT3C,UAUH;AAGA;AAAA,EADP,MAAM;AAAA,GAZI,UAaH;AAbG,YAAN;AAAA,EADN,cAAc,YAAY;AAAA,GACd;","names":["variables"]}
@@ -0,0 +1,269 @@
1
+ import {
2
+ sessionContext
3
+ } from "./chunk-22IRJWWY.js";
4
+ import {
5
+ testContext
6
+ } from "./chunk-CJADUWEC.js";
7
+ import {
8
+ computedContext
9
+ } from "./chunk-AZIKAG7K.js";
10
+ import {
11
+ __decorateClass
12
+ } from "./chunk-H2JE6IVU.js";
13
+
14
+ // src/lib/qti-test/components/test-navigation.ts
15
+ import { consume, provide } from "@lit/context";
16
+ import { html, LitElement } from "lit";
17
+ import { customElement, property, state } from "lit/decorators.js";
18
+ var TestNavigation = class extends LitElement {
19
+ constructor() {
20
+ super();
21
+ this.identifier = void 0;
22
+ this.initContext = [];
23
+ this.configContext = {};
24
+ this.autoScoreItems = false;
25
+ this.addEventListener("qti-assessment-test-connected", this._handleTestConnected.bind(this));
26
+ this.addEventListener("qti-assessment-item-connected", this._handleItemConnected.bind(this));
27
+ this.addEventListener("qti-interaction-changed", this._handleInteractionChanged.bind(this));
28
+ this.addEventListener("test-end-attempt", this._handleTestEndAttempt.bind(this));
29
+ this.addEventListener("test-show-correct-response", this._handleTestShowCorrectResponse.bind(this));
30
+ this.addEventListener("test-update-outcome-variable", this._handleTestUpdateOutcomeVariable.bind(this));
31
+ }
32
+ /**
33
+ * Handles the 'test-end-attempt' event.
34
+ * @private
35
+ * @listens TestNavigation#test-end-attempt
36
+ * @param {CustomEvent} event - The custom event object.
37
+ */
38
+ _handleTestEndAttempt(_event) {
39
+ const qtiItemEl = this._testElement.querySelector(
40
+ `qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`
41
+ );
42
+ const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
43
+ const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
44
+ qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);
45
+ }
46
+ // protected createRenderRoot(): HTMLElement | DocumentFragment {
47
+ // return this;
48
+ // }
49
+ // myTemplate: TemplateFunction;
50
+ // connectedCallback(): void {
51
+ // super.connectedCallback();
52
+ // const templateElement = this.querySelector<HTMLTemplateElement>('template');
53
+ // if (!templateElement) {
54
+ // this.myTemplate = null;
55
+ // return;
56
+ // }
57
+ // this.myTemplate = prepareTemplate(templateElement);
58
+ // }
59
+ /**
60
+ * Handles the 'test-end-attempt' event.
61
+ * @private
62
+ * @listens TestNavigation#test-show-correct-response
63
+ * @param {CustomEvent} event - The custom event object.
64
+ */
65
+ _handleTestShowCorrectResponse(event) {
66
+ const qtiItemEl = this._testElement.querySelector(
67
+ `qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`
68
+ );
69
+ const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
70
+ qtiAssessmentItemEl.showCorrectResponse(event.detail);
71
+ }
72
+ _handleTestUpdateOutcomeVariable(event) {
73
+ const qtiItemEl = this._testElement.querySelector(
74
+ `qti-assessment-item-ref[identifier="${event.detail.assessmentItemRefId}"]`
75
+ );
76
+ const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
77
+ qtiAssessmentItemEl.setOutcomeVariable(event.detail.outcomeVariableId, event.detail.value);
78
+ }
79
+ _handleInteractionChanged(_event) {
80
+ if (this.autoScoreItems) {
81
+ const assessmentItem = _event.composedPath()[0].closest("qti-assessment-item");
82
+ const scoreOutcomeIdentifier = assessmentItem.variables.find((v) => v.identifier === "SCORE");
83
+ if (scoreOutcomeIdentifier && scoreOutcomeIdentifier.externalScored === null && assessmentItem.adaptive === "false") {
84
+ const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
85
+ assessmentItem.processResponse(true, reportValidityAfterScoring);
86
+ }
87
+ }
88
+ }
89
+ render() {
90
+ return html`<slot></slot>`;
91
+ }
92
+ /* PK: on test connected we can build the computed context */
93
+ _handleTestConnected(event) {
94
+ this._testElement = event.detail;
95
+ const testPartElements = Array.from(this._testElement?.querySelectorAll(`qti-test-part`) || []);
96
+ this.computedContext = {
97
+ identifier: this._testElement.identifier,
98
+ title: this._testElement.title,
99
+ view: this._sessionContext?.view,
100
+ testParts: testPartElements.map((testPart) => {
101
+ const sectionElements = [...testPart.querySelectorAll(`qti-assessment-section`)];
102
+ return {
103
+ active: false,
104
+ identifier: testPart.identifier,
105
+ navigationMode: testPart.navigationMode,
106
+ submissionMode: testPart.submissionMode,
107
+ sections: sectionElements.map((section) => {
108
+ const itemElements = [...section.querySelectorAll(`qti-assessment-item-ref`)];
109
+ return {
110
+ active: false,
111
+ identifier: section.identifier,
112
+ title: section.title,
113
+ items: itemElements.map((item) => ({
114
+ ...this.initContext?.find((i) => i.identifier === item.identifier),
115
+ active: false,
116
+ identifier: item.identifier,
117
+ categories: item.category ? item.category?.split(" ") : [],
118
+ href: item.href,
119
+ variables: []
120
+ }))
121
+ };
122
+ })
123
+ };
124
+ })
125
+ };
126
+ }
127
+ /* PK: on item connected we can add item only properties in the xml */
128
+ _handleItemConnected(event) {
129
+ const itemElement = event.detail;
130
+ this.computedContext = {
131
+ ...this.computedContext,
132
+ testParts: this.computedContext.testParts.map((testPart) => {
133
+ return {
134
+ ...testPart,
135
+ sections: testPart.sections.map((section) => {
136
+ return {
137
+ ...section,
138
+ items: section.items.map((item) => {
139
+ if (item.identifier !== itemElement.parentElement.getAttribute("identifier")) {
140
+ return item;
141
+ }
142
+ const scoreOutcome = itemElement.querySelector(
143
+ "qti-outcome-declaration[identifier='SCORE']"
144
+ );
145
+ const externalScored = scoreOutcome?.getAttribute("externalScored");
146
+ const responseDeclarations = itemElement.querySelectorAll("qti-response-declaration");
147
+ const containsCorrectResponse = Array.from(responseDeclarations).some(
148
+ (r) => r.querySelector("qti-correct-response")
149
+ );
150
+ const containsMapping = Array.from(responseDeclarations).some((r) => {
151
+ const mapping = r.querySelector("qti-mapping");
152
+ const areaMapping = r.querySelector("qti-area-mapping");
153
+ return mapping?.querySelector("qti-map-entry") || areaMapping?.querySelector("qti-area-map-entry");
154
+ });
155
+ const hasCorrectResponse = containsCorrectResponse || containsMapping;
156
+ const hasResponseProcessing = itemElement.querySelector("qti-response-processing") ? true : false;
157
+ return {
158
+ ...item,
159
+ assessmentItemIdentifier: itemElement.getAttribute("identifier"),
160
+ label: itemElement.getAttribute("label"),
161
+ title: itemElement.title,
162
+ externalScored,
163
+ adaptive: itemElement.adaptive == "true" || false,
164
+ timeDependent: itemElement.timeDependent == "true" || false,
165
+ variables: itemElement.variables,
166
+ hasCorrectResponse,
167
+ hasResponseProcessing
168
+ };
169
+ })
170
+ };
171
+ })
172
+ };
173
+ })
174
+ };
175
+ }
176
+ /* PK: on every change of the candidate we will recomputed the computedContext */
177
+ willUpdate(_changedProperties) {
178
+ if (!this.computedContext) return;
179
+ let itemIndex = 1;
180
+ this.computedContext = {
181
+ ...this.computedContext,
182
+ view: this._sessionContext?.view,
183
+ testParts: this.computedContext.testParts.map((testPart) => {
184
+ return {
185
+ ...testPart,
186
+ active: this._sessionContext?.navPartId === testPart.identifier || false,
187
+ sections: testPart.sections.map((section) => {
188
+ return {
189
+ ...section,
190
+ active: this._sessionContext?.navSectionId === section.identifier || false,
191
+ completed: section.items.every(
192
+ (item) => this._testContext.items.find((i) => i.identifier === item.identifier)?.variables.find((v) => v.identifier === "completionStatus").value === "completed"
193
+ ),
194
+ items: section.items.map((item) => {
195
+ const itemContext = this._testContext?.items.find((i) => i.identifier === item.identifier);
196
+ const computedItem = {
197
+ ...item,
198
+ ...itemContext,
199
+ ...this.initContext?.find((i) => i.identifier === item.identifier)
200
+ };
201
+ const rawscore = computedItem.variables?.find((vr) => vr.identifier == "SCORE")?.value;
202
+ const score = parseInt(rawscore?.toString());
203
+ const completionStatus = computedItem.variables?.find((v) => v.identifier === "completionStatus")?.value;
204
+ const response = computedItem.variables?.find((v) => v.identifier === "RESPONSE")?.value || "";
205
+ const numAttempts = computedItem.variables?.find((v) => v.identifier === "numAttempts")?.value || 0;
206
+ const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;
207
+ const index = item.categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;
208
+ const rawMaxScore = item.variables?.find((vr) => vr.identifier == "MAXSCORE")?.value;
209
+ const maxScore = parseInt(rawMaxScore?.toString());
210
+ return {
211
+ ...computedItem,
212
+ completionStatus,
213
+ numAttempts,
214
+ score,
215
+ response,
216
+ index,
217
+ // type,
218
+ active,
219
+ // correct,
220
+ maxScore
221
+ // incorrect,
222
+ // completed
223
+ };
224
+ })
225
+ };
226
+ })
227
+ };
228
+ })
229
+ };
230
+ this.dispatchEvent(
231
+ new CustomEvent("qti-computed-context-updated", {
232
+ detail: this.computedContext,
233
+ bubbles: true
234
+ })
235
+ );
236
+ }
237
+ };
238
+ __decorateClass([
239
+ property({ type: String })
240
+ ], TestNavigation.prototype, "identifier", 2);
241
+ __decorateClass([
242
+ state()
243
+ ], TestNavigation.prototype, "initContext", 2);
244
+ __decorateClass([
245
+ state()
246
+ ], TestNavigation.prototype, "configContext", 2);
247
+ __decorateClass([
248
+ state(),
249
+ consume({ context: testContext, subscribe: true })
250
+ ], TestNavigation.prototype, "_testContext", 2);
251
+ __decorateClass([
252
+ state(),
253
+ consume({ context: sessionContext, subscribe: true })
254
+ ], TestNavigation.prototype, "_sessionContext", 2);
255
+ __decorateClass([
256
+ state(),
257
+ provide({ context: computedContext })
258
+ ], TestNavigation.prototype, "computedContext", 2);
259
+ __decorateClass([
260
+ property({ type: Boolean, attribute: "auto-score-items" })
261
+ ], TestNavigation.prototype, "autoScoreItems", 2);
262
+ TestNavigation = __decorateClass([
263
+ customElement("test-navigation")
264
+ ], TestNavigation);
265
+
266
+ export {
267
+ TestNavigation
268
+ };
269
+ //# sourceMappingURL=chunk-GRQYHS5X.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-navigation.ts"],"sourcesContent":["import { consume, provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n// import { prepareTemplate } from 'stampino';\n\nimport { testContext } from '../../exports/test.context';\nimport { sessionContext } from '../../exports/session.context';\nimport { computedContext } from '../../exports/computed.context';\n\n// import type { View } from '../core/mixins/test-view.mixin';\n// import type { TemplateFunction } from 'stampino';\nimport type { QtiAssessmentItem } from '../../qti-components';\nimport type { OutcomeVariable } from '../../exports/variables';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { PropertyValues } from 'lit';\nimport type { QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiTestPart } from '../core';\nimport type { ConfigContext } from '../../exports/config.context';\nimport type { SessionContext } from '../../exports/session.context';\nimport type { TestContext } from '../../exports/test.context';\n\ntype CustomEventMap = {\n 'test-end-attempt': CustomEvent;\n 'test-show-correct-response': CustomEvent<{ value: boolean }>;\n};\n\ndeclare global {\n interface GlobalEventHandlersEventMap extends CustomEventMap {}\n}\n\n@customElement('test-navigation')\nexport class TestNavigation extends LitElement {\n @property({ type: String }) identifier = undefined;\n\n @state()\n public initContext: { identifier: string; [key: string]: any }[] = [];\n\n @state()\n public configContext: ConfigContext = {};\n\n @state()\n @consume({ context: testContext, subscribe: true })\n protected _testContext?: TestContext;\n\n @state()\n @consume({ context: sessionContext, subscribe: true })\n protected _sessionContext?: SessionContext;\n\n @state()\n @provide({ context: computedContext })\n protected computedContext: ComputedContext;\n\n @property({ type: Boolean, attribute: 'auto-score-items' }) autoScoreItems = false;\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 // @property({ type: Boolean, reflect: true }) public debug = false;\n\n private _testElement: QtiAssessmentTest;\n\n constructor() {\n super();\n this.addEventListener('qti-assessment-test-connected', this._handleTestConnected.bind(this));\n this.addEventListener('qti-assessment-item-connected', this._handleItemConnected.bind(this));\n\n this.addEventListener('qti-interaction-changed', this._handleInteractionChanged.bind(this));\n\n this.addEventListener('test-end-attempt', this._handleTestEndAttempt.bind(this));\n this.addEventListener('test-show-correct-response', this._handleTestShowCorrectResponse.bind(this));\n this.addEventListener('test-update-outcome-variable', this._handleTestUpdateOutcomeVariable.bind(this));\n }\n\n /**\n * Handles the 'test-end-attempt' event.\n * @private\n * @listens TestNavigation#test-end-attempt\n * @param {CustomEvent} event - The custom event object.\n */\n private _handleTestEndAttempt(_event: CustomEvent) {\n const qtiItemEl = this._testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemRefId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);\n }\n\n // protected createRenderRoot(): HTMLElement | DocumentFragment {\n // return this;\n // }\n\n // myTemplate: TemplateFunction;\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 /**\n * Handles the 'test-end-attempt' event.\n * @private\n * @listens TestNavigation#test-show-correct-response\n * @param {CustomEvent} event - The custom event object.\n */\n private _handleTestShowCorrectResponse(event: CustomEvent) {\n const qtiItemEl = this._testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemRefId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n qtiAssessmentItemEl.showCorrectResponse(event.detail);\n }\n\n private _handleTestUpdateOutcomeVariable(event: CustomEvent) {\n const qtiItemEl = this._testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${event.detail.assessmentItemRefId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n qtiAssessmentItemEl.setOutcomeVariable(event.detail.outcomeVariableId, event.detail.value);\n }\n\n private _handleInteractionChanged(_event: CustomEvent) {\n if (this.autoScoreItems) {\n const assessmentItem = (_event.composedPath()[0] as HTMLElement).closest('qti-assessment-item');\n const scoreOutcomeIdentifier = assessmentItem.variables.find(v => v.identifier === 'SCORE') as OutcomeVariable;\n if (\n scoreOutcomeIdentifier &&\n scoreOutcomeIdentifier.externalScored === null &&\n assessmentItem.adaptive === 'false'\n ) {\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n assessmentItem.processResponse(true, reportValidityAfterScoring);\n }\n }\n }\n\n render() {\n // return this.myTemplate ? this.myTemplate(this.stampContext) : nothing;\n return html`<slot></slot>`;\n }\n\n /* PK: on test connected we can build the computed context */\n private _handleTestConnected(event: CustomEvent) {\n this._testElement = event.detail as QtiAssessmentTest;\n const testPartElements = Array.from(this._testElement?.querySelectorAll<QtiTestPart>(`qti-test-part`) || []);\n this.computedContext = {\n identifier: this._testElement.identifier,\n title: this._testElement.title,\n view: this._sessionContext?.view,\n testParts: testPartElements.map(testPart => {\n const sectionElements = [...testPart.querySelectorAll<QtiAssessmentSection>(`qti-assessment-section`)];\n return {\n active: false,\n identifier: testPart.identifier,\n navigationMode: testPart.navigationMode,\n submissionMode: testPart.submissionMode,\n sections: sectionElements.map(section => {\n const itemElements = [...section.querySelectorAll<QtiAssessmentItemRef>(`qti-assessment-item-ref`)];\n return {\n active: false,\n identifier: section.identifier,\n title: section.title,\n items: itemElements.map(item => ({\n ...this.initContext?.find(i => i.identifier === item.identifier),\n active: false,\n identifier: item.identifier,\n categories: item.category ? item.category?.split(' ') : [],\n href: item.href,\n variables: []\n }))\n };\n })\n };\n })\n };\n }\n\n /* PK: on item connected we can add item only properties in the xml */\n private _handleItemConnected(event: CustomEvent) {\n const itemElement = event.detail as QtiAssessmentItem;\n\n this.computedContext = {\n ...this.computedContext,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n items: section.items.map(item => {\n if (item.identifier !== itemElement.parentElement.getAttribute('identifier')) {\n return item;\n }\n\n const scoreOutcome = itemElement.querySelector<HTMLElement>(\n \"qti-outcome-declaration[identifier='SCORE']\"\n );\n // const scoreOutcome = item.variables.find(vr => vr.identifier == 'SCORE') as OutcomeVariable;\n const externalScored = scoreOutcome?.getAttribute('externalScored');\n\n const responseDeclarations = itemElement.querySelectorAll<HTMLElement>('qti-response-declaration');\n const containsCorrectResponse = Array.from(responseDeclarations).some(r =>\n r.querySelector('qti-correct-response')\n );\n // check if every responseDeclaration has a correctResponse\n const containsMapping = Array.from(responseDeclarations).some(r => {\n const mapping = r.querySelector('qti-mapping');\n const areaMapping = r.querySelector('qti-area-mapping');\n return mapping?.querySelector('qti-map-entry') || areaMapping?.querySelector('qti-area-map-entry');\n });\n\n const hasCorrectResponse = containsCorrectResponse || containsMapping;\n\n const hasResponseProcessing = itemElement.querySelector('qti-response-processing') ? true : false;\n\n return {\n ...item,\n assessmentItemIdentifier: itemElement.getAttribute('identifier'),\n label: itemElement.getAttribute('label'),\n title: itemElement.title,\n externalScored,\n adaptive: itemElement.adaptive == 'true' || false,\n timeDependent: itemElement.timeDependent == 'true' || false,\n variables: itemElement.variables,\n hasCorrectResponse,\n hasResponseProcessing\n };\n })\n };\n })\n };\n })\n };\n }\n\n /* PK: on every change of the candidate we will recomputed the computedContext */\n protected willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) return;\n\n let itemIndex = 1;\n this.computedContext = {\n ...this.computedContext,\n view: this._sessionContext?.view,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n active: this._sessionContext?.navPartId === testPart.identifier || false,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n active: this._sessionContext?.navSectionId === section.identifier || false,\n completed: section.items.every(\n item =>\n this._testContext.items\n .find(i => i.identifier === item.identifier)\n ?.variables.find(v => v.identifier === 'completionStatus').value === 'completed'\n ),\n\n items: section.items.map(item => {\n const itemContext = this._testContext?.items.find(i => i.identifier === item.identifier);\n const computedItem = {\n ...item,\n ...itemContext,\n ...this.initContext?.find(i => i.identifier === item.identifier)\n };\n\n const rawscore = computedItem.variables?.find(vr => vr.identifier == 'SCORE')?.value;\n const score = parseInt(rawscore?.toString());\n\n const completionStatus = computedItem.variables?.find(v => v.identifier === 'completionStatus')\n ?.value as string;\n\n const response = computedItem.variables?.find(v => v.identifier === 'RESPONSE')?.value || '';\n const numAttempts = computedItem.variables?.find(v => v.identifier === 'numAttempts')?.value || 0;\n\n const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;\n\n // Computed and opiniated\n // const type = item.categories.includes(this.configContext?.infoItemCategory) ? 'info' : 'regular';\n // const correct = (type == 'regular' && score !== undefined && !isNaN(score) && score > 0) || false;\n // const incorrect = (type == 'regular' && score !== undefined && !isNaN(score) && score <= 0) || false;\n // const completed = completionStatus === 'completed';\n\n const index = item.categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;\n const rawMaxScore = item.variables?.find(vr => vr.identifier == 'MAXSCORE')?.value;\n const maxScore = parseInt(rawMaxScore?.toString());\n\n return {\n ...computedItem,\n completionStatus,\n numAttempts,\n score,\n response,\n index,\n // type,\n active,\n // correct,\n maxScore\n // incorrect,\n // completed\n };\n })\n };\n })\n };\n })\n };\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 // if (!activeTestPart || !activeSection || !activeItem) {\n // this.stampContext = null;\n // return;\n // }\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 this.dispatchEvent(\n new CustomEvent('qti-computed-context-updated', {\n detail: this.computedContext,\n bubbles: true\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,SAAS,eAAe;AACjC,SAAS,MAAM,kBAAkB;AACjC,SAAS,eAAe,UAAU,aAAa;AA4BxC,IAAM,iBAAN,cAA6B,WAAW;AAAA,EA6C7C,cAAc;AACZ,UAAM;AA7CoB,sBAAa;AAGzC,SAAO,cAA4D,CAAC;AAGpE,SAAO,gBAA+B,CAAC;AAcqB,0BAAiB;AA0B3E,SAAK,iBAAiB,iCAAiC,KAAK,qBAAqB,KAAK,IAAI,CAAC;AAC3F,SAAK,iBAAiB,iCAAiC,KAAK,qBAAqB,KAAK,IAAI,CAAC;AAE3F,SAAK,iBAAiB,2BAA2B,KAAK,0BAA0B,KAAK,IAAI,CAAC;AAE1F,SAAK,iBAAiB,oBAAoB,KAAK,sBAAsB,KAAK,IAAI,CAAC;AAC/E,SAAK,iBAAiB,8BAA8B,KAAK,+BAA+B,KAAK,IAAI,CAAC;AAClG,SAAK,iBAAiB,gCAAgC,KAAK,iCAAiC,KAAK,IAAI,CAAC;AAAA,EACxG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,sBAAsB,QAAqB;AACjD,UAAM,YAAY,KAAK,aAAa;AA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;AAAA,kBAEA;AAAA;AAAA,kBAEA;AAAA;AAAA;AAAA,gBAGF;AAAA,cACF,CAAC;AAAA,YACH;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MACF,CAAC;AAAA,IACH;AAgCA,SAAK;AAAA,MACH,IAAI,YAAY,gCAAgC;AAAA,QAC9C,QAAQ,KAAK;AAAA,QACb,SAAS;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF;AACF;AA7U8B;AAAA,EAA3B,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GADf,eACiB;AAGrB;AAAA,EADN,MAAM;AAAA,GAHI,eAIJ;AAGA;AAAA,EADN,MAAM;AAAA,GANI,eAOJ;AAIG;AAAA,EAFT,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,aAAa,WAAW,KAAK,CAAC;AAAA,GAVvC,eAWD;AAIA;AAAA,EAFT,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,gBAAgB,WAAW,KAAK,CAAC;AAAA,GAd1C,eAeD;AAIA;AAAA,EAFT,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,gBAAgB,CAAC;AAAA,GAlB1B,eAmBD;AAEkD;AAAA,EAA3D,SAAS,EAAE,MAAM,SAAS,WAAW,mBAAmB,CAAC;AAAA,GArB/C,eAqBiD;AArBjD,iBAAN;AAAA,EADN,cAAc,iBAAiB;AAAA,GACnB;","names":[]}
@@ -0,0 +1,43 @@
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-section-buttons-stamp.ts
9
+ import { html, LitElement } from "lit";
10
+ import { customElement } from "lit/decorators.js";
11
+ import { prepareTemplate } from "@heximal/templates";
12
+ import { consume } from "@lit/context";
13
+ var TestSectionButtonsStamp = class extends LitElement {
14
+ createRenderRoot() {
15
+ return this;
16
+ }
17
+ constructor() {
18
+ super();
19
+ this._internals = this.attachInternals();
20
+ this._internals.ariaLabel = "pagination";
21
+ }
22
+ connectedCallback() {
23
+ super.connectedCallback();
24
+ const templateElement = this.querySelector("template");
25
+ this.myTemplate = prepareTemplate(templateElement);
26
+ }
27
+ render() {
28
+ if (!this.computedContext) return html``;
29
+ const sections = this.computedContext.testParts.flatMap((testPart) => testPart.sections);
30
+ return html` ${sections.map((item) => this.myTemplate({ item }))} `;
31
+ }
32
+ };
33
+ __decorateClass([
34
+ consume({ context: computedContext, subscribe: true })
35
+ ], TestSectionButtonsStamp.prototype, "computedContext", 2);
36
+ TestSectionButtonsStamp = __decorateClass([
37
+ customElement("test-section-buttons-stamp")
38
+ ], TestSectionButtonsStamp);
39
+
40
+ export {
41
+ TestSectionButtonsStamp
42
+ };
43
+ //# sourceMappingURL=chunk-KSXNC564.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-section-buttons-stamp.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { prepareTemplate } from '@heximal/templates';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from '@heximal/templates';\n\n/**\n * @deprecated test-section-buttons-stamp is deprecated and will be removed in the future.\n */\n@customElement('test-section-buttons-stamp')\nexport class TestSectionButtonsStamp extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n myTemplate: TemplateFunction;\n private _internals: ElementInternals;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n this._internals.ariaLabel = 'pagination';\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n const templateElement = this.querySelector<HTMLTemplateElement>('template');\n this.myTemplate = prepareTemplate(templateElement);\n }\n\n render() {\n if (!this.computedContext) return html``;\n const sections = this.computedContext.testParts.flatMap(testPart => testPart.sections);\n\n return html` ${sections.map(item => this.myTemplate({ item }))} `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-section-buttons-stamp': TestSectionButtonsStamp;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,kBAAkB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,eAAe;AAWjB,IAAM,0BAAN,cAAsC,WAAW;AAAA,EAO5C,mBAAmD;AAC3D,WAAO;AAAA,EACT;AAAA,EAEA,cAAc;AACZ,UAAM;AACN,SAAK,aAAa,KAAK,gBAAgB;AACvC,SAAK,WAAW,YAAY;AAAA,EAC9B;AAAA,EAEA,oBAA0B;AACxB,UAAM,kBAAkB;AACxB,UAAM,kBAAkB,KAAK,cAAmC,UAAU;AAC1E,SAAK,aAAa,gBAAgB,eAAe;AAAA,EACnD;AAAA,EAEA,SAAS;AACP,QAAI,CAAC,KAAK,gBAAiB,QAAO;AAClC,UAAM,WAAW,KAAK,gBAAgB,UAAU,QAAQ,cAAY,SAAS,QAAQ;AAErF,WAAO,QAAQ,SAAS,IAAI,UAAQ,KAAK,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;AAAA,EAChE;AACF;AA3BU;AAAA,EADP,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAD3C,wBAEH;AAFG,0BAAN;AAAA,EADN,cAAc,4BAA4B;AAAA,GAC9B;","names":[]}