@citolab/qti-components 7.2.1 → 7.2.2

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 (248) hide show
  1. package/cdn/chunks/chunk-2EE5IVNF.js +1 -0
  2. package/cdn/chunks/chunk-2S62LLS5.js +2 -0
  3. package/cdn/chunks/chunk-33KVDPBT.js +5 -0
  4. package/cdn/chunks/chunk-4TNE5ZQS.js +5 -0
  5. package/cdn/chunks/chunk-57ZBXU3V.js +5 -0
  6. package/cdn/chunks/chunk-5RGC3O3Z.js +3 -0
  7. package/cdn/chunks/chunk-5WJBI6M7.js +1033 -0
  8. package/cdn/chunks/chunk-66BMMESW.js +2 -0
  9. package/cdn/chunks/chunk-6D53FU3U.js +2 -0
  10. package/cdn/chunks/chunk-72GJGEI2.js +2 -0
  11. package/cdn/chunks/chunk-73GTDWYG.js +2 -0
  12. package/cdn/chunks/chunk-7G2JKRYL.js +3 -0
  13. package/cdn/chunks/chunk-7HDBTHS7.js +2 -0
  14. package/cdn/chunks/chunk-7U6V7TMQ.js +1 -0
  15. package/cdn/chunks/chunk-BH7YS4N7.js +5 -0
  16. package/cdn/chunks/chunk-DAKW2UJX.js +3 -0
  17. package/cdn/chunks/chunk-DPW6VAG2.js +3441 -0
  18. package/cdn/chunks/chunk-DQCUGHMI.js +2 -0
  19. package/cdn/chunks/chunk-DTD5NE7V.js +2 -0
  20. package/cdn/chunks/chunk-EJE3C3VD.js +5 -0
  21. package/cdn/chunks/chunk-FGT2KVW2.js +1 -0
  22. package/cdn/chunks/chunk-FXG6JQNB.js +3 -0
  23. package/cdn/chunks/chunk-G3O7FTGW.js +2 -0
  24. package/cdn/chunks/chunk-GSDSRYPT.js +5 -0
  25. package/cdn/chunks/chunk-GW7MTJY4.js +2 -0
  26. package/cdn/chunks/chunk-HNZFDARC.js +2 -0
  27. package/cdn/chunks/chunk-I37HIF37.js +2 -0
  28. package/cdn/chunks/chunk-IFSRAUBH.js +1 -0
  29. package/cdn/chunks/chunk-IJ47QETV.js +2 -0
  30. package/cdn/chunks/chunk-JVY3MIVH.js +5 -0
  31. package/cdn/chunks/chunk-JXGYDOJM.js +3 -0
  32. package/cdn/chunks/chunk-K3HDRUZ2.js +2 -0
  33. package/cdn/chunks/chunk-KGNJ44AT.js +2 -0
  34. package/cdn/chunks/chunk-KM6BQLUW.js +2 -0
  35. package/cdn/chunks/chunk-KMPDXXNC.js +5 -0
  36. package/cdn/chunks/chunk-KPFC2HQR.js +3 -0
  37. package/cdn/chunks/chunk-KZQ2VXMQ.js +2 -0
  38. package/cdn/chunks/chunk-LEC3TBJ3.js +2 -0
  39. package/cdn/chunks/chunk-ME2BEQTK.js +3463 -0
  40. package/cdn/chunks/chunk-MM3TTGOD.js +5 -0
  41. package/cdn/chunks/chunk-NBXY7TMD.js +2 -0
  42. package/cdn/chunks/chunk-NCNOPEEF.js +2 -0
  43. package/cdn/chunks/chunk-O7JELRBY.js +2 -0
  44. package/cdn/chunks/chunk-OCQAZUB6.js +2 -0
  45. package/cdn/chunks/chunk-QBBWQ5J6.js +5 -0
  46. package/cdn/chunks/chunk-QPP7ZB2K.js +5 -0
  47. package/cdn/chunks/chunk-RSOX5VS5.js +3 -0
  48. package/cdn/chunks/chunk-SHXTMXYU.js +1 -0
  49. package/cdn/chunks/chunk-SNRRONMC.js +2 -0
  50. package/cdn/chunks/chunk-SUDAVHNM.js +1 -0
  51. package/cdn/chunks/chunk-UUKFU4BI.js +2 -0
  52. package/cdn/chunks/chunk-V65TZQVT.js +2 -0
  53. package/cdn/chunks/chunk-VIW7IGYG.js +2 -0
  54. package/cdn/chunks/chunk-W7LBE76A.js +5 -0
  55. package/cdn/chunks/chunk-WANQ7VHH.js +2 -0
  56. package/cdn/chunks/chunk-WI3S4WLU.js +2 -0
  57. package/cdn/chunks/chunk-WQK3JD6Q.js +5 -0
  58. package/cdn/chunks/chunk-WRAMSS3Q.js +3465 -0
  59. package/cdn/chunks/chunk-XLY6GBBJ.js +2 -0
  60. package/cdn/chunks/chunk-XNII2G63.js +3468 -0
  61. package/cdn/chunks/chunk-YSCJG7CX.js +3461 -0
  62. package/cdn/index.js +1 -1
  63. package/cdn/qti-item/components/item-container.js +1 -1
  64. package/cdn/qti-item/core/index.js +1 -1
  65. package/cdn/qti-test/components/index.js +1 -1
  66. package/cdn/qti-test/components/test-container.js +1 -1
  67. package/cdn/qti-test/components/test-navigation.js +1 -1
  68. package/cdn/qti-test/components/test-print-context.js +1 -1
  69. package/cdn/qti-test/components/test-stamp.js +1 -1
  70. package/cdn/qti-test/core/index.js +1 -1
  71. package/dist/chunks/chunk-25AXOL6N.js +73 -0
  72. package/dist/chunks/chunk-25AXOL6N.js.map +1 -0
  73. package/dist/chunks/chunk-34ZMZ5GH.js +76 -0
  74. package/dist/chunks/chunk-34ZMZ5GH.js.map +1 -0
  75. package/dist/chunks/chunk-3UPSFFDF.js +45 -0
  76. package/dist/chunks/chunk-3UPSFFDF.js.map +1 -0
  77. package/dist/chunks/chunk-4NZYGJLT.js +94 -0
  78. package/dist/chunks/chunk-4NZYGJLT.js.map +1 -0
  79. package/dist/chunks/chunk-4UIDYSZL.js +78 -0
  80. package/dist/chunks/chunk-4UIDYSZL.js.map +1 -0
  81. package/dist/chunks/chunk-4V7ZPUTP.js +78 -0
  82. package/dist/chunks/chunk-4V7ZPUTP.js.map +1 -0
  83. package/dist/chunks/chunk-5IQUODBV.js +94 -0
  84. package/dist/chunks/chunk-5IQUODBV.js.map +1 -0
  85. package/dist/chunks/chunk-6B7USFAR.js +82 -0
  86. package/dist/chunks/chunk-6B7USFAR.js.map +1 -0
  87. package/dist/chunks/chunk-6IC436D3.js +95 -0
  88. package/dist/chunks/chunk-6IC436D3.js.map +1 -0
  89. package/dist/chunks/chunk-6MXANZQB.js +80 -0
  90. package/dist/chunks/chunk-6MXANZQB.js.map +1 -0
  91. package/dist/chunks/chunk-6UZG2X74.js +870 -0
  92. package/dist/chunks/chunk-6UZG2X74.js.map +1 -0
  93. package/dist/chunks/chunk-6XLSPSL3.js +94 -0
  94. package/dist/chunks/chunk-6XLSPSL3.js.map +1 -0
  95. package/dist/chunks/chunk-AXVMZW54.js +73 -0
  96. package/dist/chunks/chunk-AXVMZW54.js.map +1 -0
  97. package/dist/chunks/chunk-B5Y4EZF6.js +80 -0
  98. package/dist/chunks/chunk-B5Y4EZF6.js.map +1 -0
  99. package/dist/chunks/chunk-B7NLQTW7.js +69 -0
  100. package/dist/chunks/chunk-B7NLQTW7.js.map +1 -0
  101. package/dist/chunks/chunk-BAEQ4MHU.js +69 -0
  102. package/dist/chunks/chunk-BAEQ4MHU.js.map +1 -0
  103. package/dist/chunks/chunk-C2KEHCRU.js +80 -0
  104. package/dist/chunks/chunk-C2KEHCRU.js.map +1 -0
  105. package/dist/chunks/chunk-CL6HNHNL.js +72 -0
  106. package/dist/chunks/chunk-CL6HNHNL.js.map +1 -0
  107. package/dist/chunks/chunk-DH2EP5PV.js +81 -0
  108. package/dist/chunks/chunk-DH2EP5PV.js.map +1 -0
  109. package/dist/chunks/chunk-DIETZXSR.js +78 -0
  110. package/dist/chunks/chunk-DIETZXSR.js.map +1 -0
  111. package/dist/chunks/chunk-DOP7DN3W.js +78 -0
  112. package/dist/chunks/chunk-DOP7DN3W.js.map +1 -0
  113. package/dist/chunks/chunk-DTZHLZH2.js +8 -0
  114. package/dist/chunks/chunk-DTZHLZH2.js.map +1 -0
  115. package/dist/chunks/chunk-EBKJVMIY.js +79 -0
  116. package/dist/chunks/chunk-EBKJVMIY.js.map +1 -0
  117. package/dist/chunks/chunk-ECXRMWLT.js +94 -0
  118. package/dist/chunks/chunk-ECXRMWLT.js.map +1 -0
  119. package/dist/chunks/chunk-FDIYM6TD.js +68 -0
  120. package/dist/chunks/chunk-FDIYM6TD.js.map +1 -0
  121. package/dist/chunks/chunk-FROMX3AY.js +78 -0
  122. package/dist/chunks/chunk-FROMX3AY.js.map +1 -0
  123. package/dist/chunks/chunk-FVD3INZH.js +69 -0
  124. package/dist/chunks/chunk-FVD3INZH.js.map +1 -0
  125. package/dist/chunks/chunk-GJVATV62.js +43 -0
  126. package/dist/chunks/chunk-GJVATV62.js.map +1 -0
  127. package/dist/chunks/chunk-GWSHKTCL.js +33 -0
  128. package/dist/chunks/chunk-GWSHKTCL.js.map +1 -0
  129. package/dist/chunks/chunk-H2Z5FH4R.js +76 -0
  130. package/dist/chunks/chunk-H2Z5FH4R.js.map +1 -0
  131. package/dist/chunks/chunk-HAP6ALTQ.js +78 -0
  132. package/dist/chunks/chunk-HAP6ALTQ.js.map +1 -0
  133. package/dist/chunks/chunk-HL7H4ZGY.js +82 -0
  134. package/dist/chunks/chunk-HL7H4ZGY.js.map +1 -0
  135. package/dist/chunks/chunk-HQ7IWQPH.js +80 -0
  136. package/dist/chunks/chunk-HQ7IWQPH.js.map +1 -0
  137. package/dist/chunks/chunk-IA235UXD.js +79 -0
  138. package/dist/chunks/chunk-IA235UXD.js.map +1 -0
  139. package/dist/chunks/chunk-IIDUZWYL.js +78 -0
  140. package/dist/chunks/chunk-IIDUZWYL.js.map +1 -0
  141. package/dist/chunks/chunk-IKVCQGA6.js +79 -0
  142. package/dist/chunks/chunk-IKVCQGA6.js.map +1 -0
  143. package/dist/chunks/chunk-IT6EGJUH.js +68 -0
  144. package/dist/chunks/chunk-IT6EGJUH.js.map +1 -0
  145. package/dist/chunks/chunk-IWSVL7HX.js +94 -0
  146. package/dist/chunks/chunk-IWSVL7HX.js.map +1 -0
  147. package/dist/chunks/chunk-K5SSEHCG.js +92 -0
  148. package/dist/chunks/chunk-K5SSEHCG.js.map +1 -0
  149. package/dist/chunks/chunk-KYGAKC4X.js +82 -0
  150. package/dist/chunks/chunk-KYGAKC4X.js.map +1 -0
  151. package/dist/chunks/chunk-LT563K5H.js +78 -0
  152. package/dist/chunks/chunk-LT563K5H.js.map +1 -0
  153. package/dist/chunks/chunk-LVWZUV4A.js +86 -0
  154. package/dist/chunks/chunk-LVWZUV4A.js.map +1 -0
  155. package/dist/chunks/chunk-MCMAHBGE.js +3455 -0
  156. package/dist/chunks/chunk-MCMAHBGE.js.map +1 -0
  157. package/dist/chunks/chunk-NFPHKFFE.js +78 -0
  158. package/dist/chunks/chunk-NFPHKFFE.js.map +1 -0
  159. package/dist/chunks/chunk-NLW7S5TN.js +94 -0
  160. package/dist/chunks/chunk-NLW7S5TN.js.map +1 -0
  161. package/dist/chunks/chunk-O2YP7VIE.js +245 -0
  162. package/dist/chunks/chunk-O2YP7VIE.js.map +1 -0
  163. package/dist/chunks/chunk-OAKKH2XA.js +99 -0
  164. package/dist/chunks/chunk-OAKKH2XA.js.map +1 -0
  165. package/dist/chunks/chunk-OBIKEFCI.js +56 -0
  166. package/dist/chunks/chunk-OBIKEFCI.js.map +1 -0
  167. package/dist/chunks/chunk-OEJMOV45.js +78 -0
  168. package/dist/chunks/chunk-OEJMOV45.js.map +1 -0
  169. package/dist/chunks/chunk-OFYYP7AK.js +94 -0
  170. package/dist/chunks/chunk-OFYYP7AK.js.map +1 -0
  171. package/dist/chunks/chunk-PJMWNLXZ.js +80 -0
  172. package/dist/chunks/chunk-PJMWNLXZ.js.map +1 -0
  173. package/dist/chunks/chunk-QGVSNUAF.js +79 -0
  174. package/dist/chunks/chunk-QGVSNUAF.js.map +1 -0
  175. package/dist/chunks/chunk-QIN2S2F7.js +94 -0
  176. package/dist/chunks/chunk-QIN2S2F7.js.map +1 -0
  177. package/dist/chunks/chunk-QKYFFNPR.js +3453 -0
  178. package/dist/chunks/chunk-QKYFFNPR.js.map +1 -0
  179. package/dist/chunks/chunk-QMIYPOBM.js +3458 -0
  180. package/dist/chunks/chunk-QMIYPOBM.js.map +1 -0
  181. package/dist/chunks/chunk-QMYMPOQQ.js +69 -0
  182. package/dist/chunks/chunk-QMYMPOQQ.js.map +1 -0
  183. package/dist/chunks/chunk-RGQDJQVE.js +3451 -0
  184. package/dist/chunks/chunk-RGQDJQVE.js.map +1 -0
  185. package/dist/chunks/chunk-SWROECSL.js +82 -0
  186. package/dist/chunks/chunk-SWROECSL.js.map +1 -0
  187. package/dist/chunks/chunk-TGF5F45T.js +94 -0
  188. package/dist/chunks/chunk-TGF5F45T.js.map +1 -0
  189. package/dist/chunks/chunk-TUVS6HU4.js +85 -0
  190. package/dist/chunks/chunk-TUVS6HU4.js.map +1 -0
  191. package/dist/chunks/chunk-UHU4AWX2.js +28 -0
  192. package/dist/chunks/chunk-UHU4AWX2.js.map +1 -0
  193. package/dist/chunks/chunk-V53ESOPP.js +79 -0
  194. package/dist/chunks/chunk-V53ESOPP.js.map +1 -0
  195. package/dist/chunks/chunk-VGGCSCVL.js +94 -0
  196. package/dist/chunks/chunk-VGGCSCVL.js.map +1 -0
  197. package/dist/chunks/chunk-WTN76Y5P.js +74 -0
  198. package/dist/chunks/chunk-WTN76Y5P.js.map +1 -0
  199. package/dist/chunks/chunk-WVMOFVRE.js +74 -0
  200. package/dist/chunks/chunk-WVMOFVRE.js.map +1 -0
  201. package/dist/chunks/chunk-WXQLAXP4.js +73 -0
  202. package/dist/chunks/chunk-WXQLAXP4.js.map +1 -0
  203. package/dist/chunks/chunk-X2ZV2OFN.js +82 -0
  204. package/dist/chunks/chunk-X2ZV2OFN.js.map +1 -0
  205. package/dist/chunks/chunk-XAJNR7FS.js +74 -0
  206. package/dist/chunks/chunk-XAJNR7FS.js.map +1 -0
  207. package/dist/chunks/chunk-YBDDKT65.js +69 -0
  208. package/dist/chunks/chunk-YBDDKT65.js.map +1 -0
  209. package/dist/chunks/chunk-YKKQ6AI7.js +69 -0
  210. package/dist/chunks/chunk-YKKQ6AI7.js.map +1 -0
  211. package/dist/chunks/chunk-YLHGELZY.js +79 -0
  212. package/dist/chunks/chunk-YLHGELZY.js.map +1 -0
  213. package/dist/chunks/chunk-YQC26WHY.js +79 -0
  214. package/dist/chunks/chunk-YQC26WHY.js.map +1 -0
  215. package/dist/chunks/chunk-ZBUXIAEV.js +3431 -0
  216. package/dist/chunks/chunk-ZBUXIAEV.js.map +1 -0
  217. package/dist/chunks/chunk-ZU6ANMBF.js +28 -0
  218. package/dist/chunks/chunk-ZU6ANMBF.js.map +1 -0
  219. package/dist/exports/computed.context.d.ts +4 -0
  220. package/dist/exports/computed.context.js +1 -1
  221. package/dist/exports/session.context.d.ts +1 -1
  222. package/dist/index.d.ts +1 -1
  223. package/dist/index.js +28 -28
  224. package/dist/item.css +6 -0
  225. package/dist/qti-components-jsx.d.ts +10 -7
  226. package/dist/qti-item/components/item-container.js +2 -2
  227. package/dist/qti-item/core/index.js +2 -2
  228. package/dist/qti-test/components/index.d.ts +1 -1
  229. package/dist/qti-test/components/index.js +19 -19
  230. package/dist/qti-test/components/test-container.js +2 -2
  231. package/dist/qti-test/components/test-navigation.d.ts +1 -1
  232. package/dist/qti-test/components/test-navigation.js +2 -2
  233. package/dist/qti-test/components/test-next.js +2 -2
  234. package/dist/qti-test/components/test-paging-buttons-stamp.js +2 -2
  235. package/dist/qti-test/components/test-prev.js +2 -2
  236. package/dist/qti-test/components/test-print-context.js +2 -2
  237. package/dist/qti-test/components/test-print-item-variables.js +2 -2
  238. package/dist/qti-test/components/test-scoring-buttons.js +2 -2
  239. package/dist/qti-test/components/test-scoring-feedback.js +2 -2
  240. package/dist/qti-test/components/test-section-buttons-stamp.js +2 -2
  241. package/dist/qti-test/components/test-show-correct-response.js +2 -2
  242. package/dist/qti-test/components/test-stamp.d.ts +8 -1
  243. package/dist/qti-test/components/test-stamp.js +2 -2
  244. package/dist/qti-test/core/index.d.ts +2 -2
  245. package/dist/qti-test/core/index.js +1 -1
  246. package/dist/qti-test-feedback-C4bd_5i4.d.ts +98 -0
  247. package/dist/vscode.html-custom-data.json +13 -7
  248. package/package.json +3 -1
@@ -0,0 +1,68 @@
1
+ import {
2
+ computedContext
3
+ } from "./chunk-DTZHLZH2.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 = null;
18
+ }
19
+ createRenderRoot() {
20
+ return this;
21
+ }
22
+ connectedCallback() {
23
+ super.connectedCallback();
24
+ const templateElement = this.querySelector("template");
25
+ if (!templateElement) {
26
+ this.myTemplate = null;
27
+ return;
28
+ }
29
+ this.myTemplate = prepareTemplate(templateElement);
30
+ }
31
+ willUpdate(_changedProperties) {
32
+ if (!this.computedContext) {
33
+ this.stampContext = null;
34
+ return;
35
+ }
36
+ const activeSection = this.computedContext.testParts.flatMap((testPart) => testPart.sections).find((section) => section.active);
37
+ const { items, ...augmentedSection } = activeSection;
38
+ const { testParts, ...activeTest } = this.computedContext;
39
+ this.stampContext = {
40
+ test: activeTest,
41
+ // testpart: augmentedTestPart,
42
+ section: augmentedSection
43
+ // item: augmentedItem
44
+ };
45
+ }
46
+ render() {
47
+ return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
48
+ ${this.stampContext && this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
49
+ }
50
+ };
51
+ __decorateClass([
52
+ property({ type: Boolean, reflect: true })
53
+ ], TestStamp.prototype, "debug", 2);
54
+ __decorateClass([
55
+ state(),
56
+ consume({ context: computedContext, subscribe: true })
57
+ ], TestStamp.prototype, "computedContext", 2);
58
+ __decorateClass([
59
+ state()
60
+ ], TestStamp.prototype, "stampContext", 2);
61
+ TestStamp = __decorateClass([
62
+ customElement("test-stamp")
63
+ ], TestStamp);
64
+
65
+ export {
66
+ TestStamp
67
+ };
68
+ //# sourceMappingURL=chunk-FDIYM6TD.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 { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\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 test?: unknown;\n testpart?: unknown;\n section?: unknown;\n item?: unknown;\n } | null = null;\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\n // const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);\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 activeSection = this.computedContext.testParts\n .flatMap(testPart => testPart.sections)\n .find(section => section.active);\n const { items, ...augmentedSection } = activeSection;\n\n // const activeItem = this.computedContext.testParts\n // .flatMap(testPart => testPart.sections.flatMap(section => section.items))\n // .find(item => item.active);\n // const { variables, ...augmentedItem } = activeItem;\n\n // if (!activeTestPart || !activeItem) {\n // this.stampContext = null;\n // return;\n // }\n\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n test: activeTest,\n // testpart: augmentedTestPart,\n section: augmentedSection\n // item: augmentedItem\n };\n }\n\n render() {\n return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}\n ${this.stampContext && 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;AASjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAEL,SAAO,QAAQ;AAOf,SAAQ,eAKG;AAAA;AAAA,EAID,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;AAYA,UAAM,gBAAgB,KAAK,gBAAgB,UACxC,QAAQ,cAAY,SAAS,QAAQ,EACrC,KAAK,aAAW,QAAQ,MAAM;AACjC,UAAM,EAAE,OAAO,GAAG,iBAAiB,IAAI;AAYvC,UAAM,EAAE,WAAW,GAAG,WAAW,IAAI,KAAK;AAE1C,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA;AAAA,MAEN,SAAS;AAAA;AAAA,IAEX;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO,QAAQ,KAAK,QAAQ,mBAAmB,KAAK,UAAU,KAAK,cAAc,MAAM,CAAC,CAAC,mBAAmB,OAAO;AAAA,MACjH,KAAK,gBAAgB,KAAK,aAAa,KAAK,WAAW,KAAK,YAAY,IAAI,OAAO;AAAA,EACvF;AACF;AA3ES;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAD/B,UAEJ;AAIC;AAAA,EAFP,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAL3C,UAMH;AAGA;AAAA,EADP,MAAM;AAAA,GARI,UASH;AATG,YAAN;AAAA,EADN,cAAc,YAAY;AAAA,GACd;","names":[]}
@@ -0,0 +1,78 @@
1
+ import {
2
+ computedContext
3
+ } from "./chunk-DTZHLZH2.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 = null;
18
+ }
19
+ createRenderRoot() {
20
+ return this;
21
+ }
22
+ connectedCallback() {
23
+ super.connectedCallback();
24
+ const templateElement = this.querySelector("template");
25
+ if (!templateElement) {
26
+ this.myTemplate = null;
27
+ return;
28
+ }
29
+ this.myTemplate = prepareTemplate(templateElement);
30
+ }
31
+ willUpdate(_changedProperties) {
32
+ if (!this.computedContext) {
33
+ this.stampContext = null;
34
+ return;
35
+ }
36
+ const activeTestPart = this.computedContext.testParts.find((testPart) => testPart.active);
37
+ const activeSection = this.computedContext.testParts.flatMap((testPart) => testPart.sections).find((section) => section.active);
38
+ const activeItem = this.computedContext.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
39
+ if (!activeTestPart || !activeItem) {
40
+ this.stampContext = null;
41
+ return;
42
+ }
43
+ const augmentedTestPart = {
44
+ ...activeTestPart,
45
+ items: activeTestPart.sections.flatMap((section) => section.items)
46
+ };
47
+ const { testParts, ...activeTest } = this.computedContext;
48
+ this.stampContext = {
49
+ test: activeTest,
50
+ testpart: augmentedTestPart,
51
+ section: activeSection,
52
+ item: activeItem
53
+ };
54
+ }
55
+ render() {
56
+ if (!this.stampContext || !this.myTemplate) return html``;
57
+ return html` ${this.debug ? html`<pre>${JSON.stringify(this.stampContext, null, 2)}</pre>` : nothing}
58
+ ${this.myTemplate(this.stampContext)}`;
59
+ }
60
+ };
61
+ __decorateClass([
62
+ property({ type: Boolean, reflect: true })
63
+ ], TestStamp.prototype, "debug", 2);
64
+ __decorateClass([
65
+ state(),
66
+ consume({ context: computedContext, subscribe: true })
67
+ ], TestStamp.prototype, "computedContext", 2);
68
+ __decorateClass([
69
+ state()
70
+ ], TestStamp.prototype, "stampContext", 2);
71
+ TestStamp = __decorateClass([
72
+ customElement("test-stamp")
73
+ ], TestStamp);
74
+
75
+ export {
76
+ TestStamp
77
+ };
78
+ //# sourceMappingURL=chunk-FROMX3AY.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 { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\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 test: unknown;\n testpart: unknown;\n section: unknown;\n item: unknown;\n } | null = null;\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\n const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);\n const activeSection = this.computedContext.testParts\n .flatMap(testPart => testPart.sections)\n .find(section => section.active);\n const activeItem = this.computedContext.testParts\n .flatMap(testPart => testPart.sections.flatMap(section => section.items))\n .find(item => item.active);\n\n if (!activeTestPart || !activeItem) {\n this.stampContext = null;\n return;\n }\n\n const augmentedTestPart = {\n ...activeTestPart,\n items: activeTestPart.sections.flatMap(section => section.items)\n };\n\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n test: activeTest,\n testpart: augmentedTestPart,\n section: activeSection,\n item: activeItem\n };\n }\n\n render() {\n if (!this.stampContext || !this.myTemplate) return html``;\n return html` ${this.debug ? html`<pre>${JSON.stringify(this.stampContext, null, 2)}</pre>` : nothing}\n ${this.myTemplate(this.stampContext)}`;\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;AASjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAEL,SAAO,QAAQ;AAOf,SAAQ,eAKG;AAAA;AAAA,EAID,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;AAEA,UAAM,iBAAiB,KAAK,gBAAgB,UAAU,KAAK,cAAY,SAAS,MAAM;AACtF,UAAM,gBAAgB,KAAK,gBAAgB,UACxC,QAAQ,cAAY,SAAS,QAAQ,EACrC,KAAK,aAAW,QAAQ,MAAM;AACjC,UAAM,aAAa,KAAK,gBAAgB,UACrC,QAAQ,cAAY,SAAS,SAAS,QAAQ,aAAW,QAAQ,KAAK,CAAC,EACvE,KAAK,UAAQ,KAAK,MAAM;AAE3B,QAAI,CAAC,kBAAkB,CAAC,YAAY;AAClC,WAAK,eAAe;AACpB;AAAA,IACF;AAEA,UAAM,oBAAoB;AAAA,MACxB,GAAG;AAAA,MACH,OAAO,eAAe,SAAS,QAAQ,aAAW,QAAQ,KAAK;AAAA,IACjE;AAEA,UAAM,EAAE,WAAW,GAAG,WAAW,IAAI,KAAK;AAE1C,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,SAAS;AACP,QAAI,CAAC,KAAK,gBAAgB,CAAC,KAAK,WAAY,QAAO;AACnD,WAAO,QAAQ,KAAK,QAAQ,YAAY,KAAK,UAAU,KAAK,cAAc,MAAM,CAAC,CAAC,WAAW,OAAO;AAAA,MAClG,KAAK,WAAW,KAAK,YAAY,CAAC;AAAA,EACtC;AACF;AArES;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAD/B,UAEJ;AAIC;AAAA,EAFP,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAL3C,UAMH;AAGA;AAAA,EADP,MAAM;AAAA,GARI,UASH;AATG,YAAN;AAAA,EADN,cAAc,YAAY;AAAA,GACd;","names":[]}
@@ -0,0 +1,69 @@
1
+ import {
2
+ computedContext
3
+ } from "./chunk-DTZHLZH2.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 = null;
18
+ }
19
+ createRenderRoot() {
20
+ return this;
21
+ }
22
+ connectedCallback() {
23
+ super.connectedCallback();
24
+ const templateElement = this.querySelector("template");
25
+ if (!templateElement) {
26
+ this.myTemplate = null;
27
+ return;
28
+ }
29
+ this.myTemplate = prepareTemplate(templateElement);
30
+ }
31
+ willUpdate(_changedProperties) {
32
+ if (!this.computedContext) {
33
+ this.stampContext = null;
34
+ return;
35
+ }
36
+ const activeSection = this.computedContext.testParts.flatMap((testPart) => testPart.sections).find((section) => section.active);
37
+ const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables, ...rest }) => rest) };
38
+ const augmentedItem = activeSection.items.find((item) => item.active);
39
+ const { testParts, ...activeTest } = this.computedContext;
40
+ this.stampContext = {
41
+ test: activeTest,
42
+ // testpart: augmentedTestPart,
43
+ section: augmentedSection,
44
+ item: augmentedItem
45
+ };
46
+ }
47
+ render() {
48
+ return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
49
+ ${this.stampContext && this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
50
+ }
51
+ };
52
+ __decorateClass([
53
+ property({ type: Boolean, reflect: true })
54
+ ], TestStamp.prototype, "debug", 2);
55
+ __decorateClass([
56
+ state(),
57
+ consume({ context: computedContext, subscribe: true })
58
+ ], TestStamp.prototype, "computedContext", 2);
59
+ __decorateClass([
60
+ state()
61
+ ], TestStamp.prototype, "stampContext", 2);
62
+ TestStamp = __decorateClass([
63
+ customElement("test-stamp")
64
+ ], TestStamp);
65
+
66
+ export {
67
+ TestStamp
68
+ };
69
+ //# sourceMappingURL=chunk-FVD3INZH.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 { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\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 test?: unknown;\n testpart?: unknown;\n section?: unknown;\n item?: unknown;\n } | null = null;\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\n // const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);\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 activeSection = this.computedContext.testParts\n .flatMap(testPart => testPart.sections)\n .find(section => section.active);\n const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables, ...rest }) => rest) };\n\n const augmentedItem = activeSection.items.find(item => item.active);\n\n // if (!activeTestPart || !activeItem) {\n // this.stampContext = null;\n // return;\n // }\n\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n test: activeTest,\n // testpart: augmentedTestPart,\n section: augmentedSection,\n item: augmentedItem\n };\n }\n\n render() {\n return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}\n ${this.stampContext && 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;AASjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAEL,SAAO,QAAQ;AAOf,SAAQ,eAKG;AAAA;AAAA,EAID,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;AAYA,UAAM,gBAAgB,KAAK,gBAAgB,UACxC,QAAQ,cAAY,SAAS,QAAQ,EACrC,KAAK,aAAW,QAAQ,MAAM;AACjC,UAAM,mBAAmB,EAAE,GAAG,eAAe,OAAO,cAAc,MAAM,IAAI,CAAC,EAAE,WAAW,GAAG,KAAK,MAAM,IAAI,EAAE;AAE9G,UAAM,gBAAgB,cAAc,MAAM,KAAK,UAAQ,KAAK,MAAM;AAOlE,UAAM,EAAE,WAAW,GAAG,WAAW,IAAI,KAAK;AAE1C,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA;AAAA,MAEN,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO,QAAQ,KAAK,QAAQ,mBAAmB,KAAK,UAAU,KAAK,cAAc,MAAM,CAAC,CAAC,mBAAmB,OAAO;AAAA,MACjH,KAAK,gBAAgB,KAAK,aAAa,KAAK,WAAW,KAAK,YAAY,IAAI,OAAO;AAAA,EACvF;AACF;AAxES;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAD/B,UAEJ;AAIC;AAAA,EAFP,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAL3C,UAMH;AAGA;AAAA,EADP,MAAM;AAAA,GARI,UASH;AATG,YAAN;AAAA,EADN,cAAc,YAAY;AAAA,GACd;","names":[]}
@@ -0,0 +1,43 @@
1
+ import {
2
+ computedContext
3
+ } from "./chunk-DTZHLZH2.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 "stampino";
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-GJVATV62.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 'stampino';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\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;AAQjB,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":[]}
@@ -0,0 +1,33 @@
1
+ import {
2
+ computedContext
3
+ } from "./chunk-DTZHLZH2.js";
4
+ import {
5
+ __decorateClass
6
+ } from "./chunk-H2JE6IVU.js";
7
+
8
+ // src/lib/qti-test/components/test-print-context.ts
9
+ import { html, LitElement } from "lit";
10
+ import { consume } from "@lit/context";
11
+ import { customElement } from "lit/decorators.js";
12
+ var TestPrintContext = class extends LitElement {
13
+ render() {
14
+ const activeItems = this.computedContext?.testParts.flatMap(
15
+ (testPart) => testPart.sections.flatMap((section) => section.items).find((item) => item.active)
16
+ );
17
+ if (!activeItems) return html``;
18
+ const activeItem = activeItems.length > 0 ? activeItems[0] : null;
19
+ delete activeItem?.variables;
20
+ return html` <small><pre>${JSON.stringify(activeItem, null, 2)}</pre></small> `;
21
+ }
22
+ };
23
+ __decorateClass([
24
+ consume({ context: computedContext, subscribe: true })
25
+ ], TestPrintContext.prototype, "computedContext", 2);
26
+ TestPrintContext = __decorateClass([
27
+ customElement("test-print-context")
28
+ ], TestPrintContext);
29
+
30
+ export {
31
+ TestPrintContext
32
+ };
33
+ //# sourceMappingURL=chunk-GWSHKTCL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-print-context.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { consume } from '@lit/context';\nimport { customElement } from 'lit/decorators.js';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedContext } from '../../exports/computed.context';\n\n@customElement('test-print-context')\nexport class TestPrintContext extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n public computedContext?: ComputedContext;\n\n render() {\n const activeItems = this.computedContext?.testParts.flatMap(testPart =>\n testPart.sections.flatMap(section => section.items).find(item => item.active)\n );\n if (!activeItems) return html``;\n const activeItem = activeItems.length > 0 ? activeItems[0] : null;\n delete activeItem?.variables;\n return html` <small><pre>${JSON.stringify(activeItem, null, 2)}</pre></small> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-print-context': TestPrintContext;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,kBAAkB;AACjC,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAOvB,IAAM,mBAAN,cAA+B,WAAW;AAAA,EAI/C,SAAS;AACP,UAAM,cAAc,KAAK,iBAAiB,UAAU;AAAA,MAAQ,cAC1D,SAAS,SAAS,QAAQ,aAAW,QAAQ,KAAK,EAAE,KAAK,UAAQ,KAAK,MAAM;AAAA,IAC9E;AACA,QAAI,CAAC,YAAa,QAAO;AACzB,UAAM,aAAa,YAAY,SAAS,IAAI,YAAY,CAAC,IAAI;AAC7D,WAAO,YAAY;AACnB,WAAO,oBAAoB,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;AAAA,EAChE;AACF;AAXS;AAAA,EADN,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAD3C,iBAEJ;AAFI,mBAAN;AAAA,EADN,cAAc,oBAAoB;AAAA,GACtB;","names":[]}
@@ -0,0 +1,76 @@
1
+ import {
2
+ computedContext
3
+ } from "./chunk-DTZHLZH2.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 = null;
18
+ }
19
+ createRenderRoot() {
20
+ return this;
21
+ }
22
+ connectedCallback() {
23
+ super.connectedCallback();
24
+ const templateElement = this.querySelector("template");
25
+ if (!templateElement) {
26
+ this.myTemplate = null;
27
+ return;
28
+ }
29
+ this.myTemplate = prepareTemplate(templateElement);
30
+ }
31
+ willUpdate(_changedProperties) {
32
+ if (!this.computedContext) {
33
+ this.stampContext = null;
34
+ return;
35
+ }
36
+ const activeTestPart = this.computedContext.testParts.find((testPart) => testPart.active);
37
+ const augmentedTestPart = {
38
+ ...activeTestPart,
39
+ items: activeTestPart.sections.flatMap((section) => section.items.map(({ variables, ...rest }) => rest))
40
+ };
41
+ const activeItem = this.computedContext.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
42
+ if (!activeTestPart || !activeItem) {
43
+ this.stampContext = null;
44
+ return;
45
+ }
46
+ const { testParts, ...activeTest } = this.computedContext;
47
+ this.stampContext = {
48
+ test: activeTest,
49
+ testpart: augmentedTestPart
50
+ // section: augmentedSection,
51
+ // item: augmentedItem
52
+ };
53
+ }
54
+ render() {
55
+ return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
56
+ ${this.stampContext && this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
57
+ }
58
+ };
59
+ __decorateClass([
60
+ property({ type: Boolean, reflect: true })
61
+ ], TestStamp.prototype, "debug", 2);
62
+ __decorateClass([
63
+ state(),
64
+ consume({ context: computedContext, subscribe: true })
65
+ ], TestStamp.prototype, "computedContext", 2);
66
+ __decorateClass([
67
+ state()
68
+ ], TestStamp.prototype, "stampContext", 2);
69
+ TestStamp = __decorateClass([
70
+ customElement("test-stamp")
71
+ ], TestStamp);
72
+
73
+ export {
74
+ TestStamp
75
+ };
76
+ //# sourceMappingURL=chunk-H2Z5FH4R.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 { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\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 test?: unknown;\n testpart?: unknown;\n section?: unknown;\n item?: unknown;\n } | null = null;\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\n const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);\n const augmentedTestPart = {\n ...activeTestPart,\n items: activeTestPart.sections.flatMap(section => section.items.map(({ variables, ...rest }) => rest))\n };\n\n // const activeSection = this.computedContext.testParts\n // .flatMap(testPart => testPart.sections)\n // .find(section => section.active);\n // const { items, ...augmentedSection } = activeSection;\n\n const activeItem = this.computedContext.testParts\n .flatMap(testPart => testPart.sections.flatMap(section => section.items))\n .find(item => item.active);\n // const { variables, ...augmentedItem } = activeItem;\n\n if (!activeTestPart || !activeItem) {\n this.stampContext = null;\n return;\n }\n\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n test: activeTest,\n testpart: augmentedTestPart\n // section: augmentedSection,\n // item: augmentedItem\n };\n }\n\n render() {\n return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}\n ${this.stampContext && 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;AASjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAEL,SAAO,QAAQ;AAOf,SAAQ,eAKG;AAAA;AAAA,EAID,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;AAEA,UAAM,iBAAiB,KAAK,gBAAgB,UAAU,KAAK,cAAY,SAAS,MAAM;AACtF,UAAM,oBAAoB;AAAA,MACxB,GAAG;AAAA,MACH,OAAO,eAAe,SAAS,QAAQ,aAAW,QAAQ,MAAM,IAAI,CAAC,EAAE,WAAW,GAAG,KAAK,MAAM,IAAI,CAAC;AAAA,IACvG;AAOA,UAAM,aAAa,KAAK,gBAAgB,UACrC,QAAQ,cAAY,SAAS,SAAS,QAAQ,aAAW,QAAQ,KAAK,CAAC,EACvE,KAAK,UAAQ,KAAK,MAAM;AAG3B,QAAI,CAAC,kBAAkB,CAAC,YAAY;AAClC,WAAK,eAAe;AACpB;AAAA,IACF;AAEA,UAAM,EAAE,WAAW,GAAG,WAAW,IAAI,KAAK;AAE1C,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,UAAU;AAAA;AAAA;AAAA,IAGZ;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO,QAAQ,KAAK,QAAQ,mBAAmB,KAAK,UAAU,KAAK,cAAc,MAAM,CAAC,CAAC,mBAAmB,OAAO;AAAA,MACjH,KAAK,gBAAgB,KAAK,aAAa,KAAK,WAAW,KAAK,YAAY,IAAI,OAAO;AAAA,EACvF;AACF;AAvES;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAD/B,UAEJ;AAIC;AAAA,EAFP,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAL3C,UAMH;AAGA;AAAA,EADP,MAAM;AAAA,GARI,UASH;AATG,YAAN;AAAA,EADN,cAAc,YAAY;AAAA,GACd;","names":[]}
@@ -0,0 +1,78 @@
1
+ import {
2
+ computedContext
3
+ } from "./chunk-DTZHLZH2.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 = null;
18
+ }
19
+ createRenderRoot() {
20
+ return this;
21
+ }
22
+ connectedCallback() {
23
+ super.connectedCallback();
24
+ const templateElement = this.querySelector("template");
25
+ if (!templateElement) {
26
+ this.myTemplate = null;
27
+ return;
28
+ }
29
+ this.myTemplate = prepareTemplate(templateElement);
30
+ }
31
+ willUpdate(_changedProperties) {
32
+ if (!this.computedContext) {
33
+ this.stampContext = null;
34
+ return;
35
+ }
36
+ const activeTestPart = this.computedContext.testParts.find((testPart) => testPart.active);
37
+ const activeSection = this.computedContext.testParts.flatMap((testPart) => testPart.sections).find((section) => section.active);
38
+ const activeItem = this.computedContext.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
39
+ if (!activeTestPart || !activeItem) {
40
+ this.stampContext = null;
41
+ return;
42
+ }
43
+ const augmentedTestPart = {
44
+ ...activeTestPart,
45
+ items: activeTestPart.sections.flatMap((section) => section.items)
46
+ };
47
+ const { testParts, ...activeTest } = this.computedContext;
48
+ this.stampContext = {
49
+ test: activeTest,
50
+ testpart: augmentedTestPart,
51
+ section: activeSection,
52
+ item: activeItem
53
+ };
54
+ }
55
+ render() {
56
+ if (!this.stampContext || !this.myTemplate) return nothing;
57
+ return html` ${this.debug ? html`<pre>${JSON.stringify(this.stampContext, null, 2)}</pre>` : nothing}
58
+ ${this.myTemplate(this.stampContext)}HOI`;
59
+ }
60
+ };
61
+ __decorateClass([
62
+ property({ type: Boolean, reflect: true })
63
+ ], TestStamp.prototype, "debug", 2);
64
+ __decorateClass([
65
+ state(),
66
+ consume({ context: computedContext, subscribe: true })
67
+ ], TestStamp.prototype, "computedContext", 2);
68
+ __decorateClass([
69
+ state()
70
+ ], TestStamp.prototype, "stampContext", 2);
71
+ TestStamp = __decorateClass([
72
+ customElement("test-stamp")
73
+ ], TestStamp);
74
+
75
+ export {
76
+ TestStamp
77
+ };
78
+ //# sourceMappingURL=chunk-HAP6ALTQ.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 { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\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 test: unknown;\n testpart: unknown;\n section: unknown;\n item: unknown;\n } | null = null;\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\n const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);\n const activeSection = this.computedContext.testParts\n .flatMap(testPart => testPart.sections)\n .find(section => section.active);\n const activeItem = this.computedContext.testParts\n .flatMap(testPart => testPart.sections.flatMap(section => section.items))\n .find(item => item.active);\n\n if (!activeTestPart || !activeItem) {\n this.stampContext = null;\n return;\n }\n\n const augmentedTestPart = {\n ...activeTestPart,\n items: activeTestPart.sections.flatMap(section => section.items)\n };\n\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n test: activeTest,\n testpart: augmentedTestPart,\n section: activeSection,\n item: activeItem\n };\n }\n\n render() {\n if (!this.stampContext || !this.myTemplate) return nothing;\n return html` ${this.debug ? html`<pre>${JSON.stringify(this.stampContext, null, 2)}</pre>` : nothing}\n ${this.myTemplate(this.stampContext)}HOI`;\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;AASjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAEL,SAAO,QAAQ;AAOf,SAAQ,eAKG;AAAA;AAAA,EAID,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;AAEA,UAAM,iBAAiB,KAAK,gBAAgB,UAAU,KAAK,cAAY,SAAS,MAAM;AACtF,UAAM,gBAAgB,KAAK,gBAAgB,UACxC,QAAQ,cAAY,SAAS,QAAQ,EACrC,KAAK,aAAW,QAAQ,MAAM;AACjC,UAAM,aAAa,KAAK,gBAAgB,UACrC,QAAQ,cAAY,SAAS,SAAS,QAAQ,aAAW,QAAQ,KAAK,CAAC,EACvE,KAAK,UAAQ,KAAK,MAAM;AAE3B,QAAI,CAAC,kBAAkB,CAAC,YAAY;AAClC,WAAK,eAAe;AACpB;AAAA,IACF;AAEA,UAAM,oBAAoB;AAAA,MACxB,GAAG;AAAA,MACH,OAAO,eAAe,SAAS,QAAQ,aAAW,QAAQ,KAAK;AAAA,IACjE;AAEA,UAAM,EAAE,WAAW,GAAG,WAAW,IAAI,KAAK;AAE1C,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,SAAS;AACP,QAAI,CAAC,KAAK,gBAAgB,CAAC,KAAK,WAAY,QAAO;AACnD,WAAO,QAAQ,KAAK,QAAQ,YAAY,KAAK,UAAU,KAAK,cAAc,MAAM,CAAC,CAAC,WAAW,OAAO;AAAA,MAClG,KAAK,WAAW,KAAK,YAAY,CAAC;AAAA,EACtC;AACF;AArES;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAD/B,UAEJ;AAIC;AAAA,EAFP,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAL3C,UAMH;AAGA;AAAA,EADP,MAAM;AAAA,GARI,UASH;AATG,YAAN;AAAA,EADN,cAAc,YAAY;AAAA,GACd;","names":[]}
@@ -0,0 +1,82 @@
1
+ import {
2
+ computedContext
3
+ } from "./chunk-DTZHLZH2.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 = null;
18
+ }
19
+ createRenderRoot() {
20
+ return this;
21
+ }
22
+ connectedCallback() {
23
+ super.connectedCallback();
24
+ const templateElement = this.querySelector("template");
25
+ if (!templateElement) {
26
+ this.myTemplate = null;
27
+ return;
28
+ }
29
+ this.myTemplate = prepareTemplate(templateElement);
30
+ }
31
+ willUpdate(_changedProperties) {
32
+ if (!this.computedContext) {
33
+ this.stampContext = null;
34
+ return;
35
+ }
36
+ const activeTestPart = this.computedContext.testParts.find((testPart) => testPart.active);
37
+ if (!activeTestPart) {
38
+ this.stampContext = null;
39
+ return;
40
+ }
41
+ const augmentedTestPart = {
42
+ ...activeTestPart,
43
+ items: activeTestPart.sections.flatMap((section) => section.items.map(({ variables, ...rest }) => rest)),
44
+ sections: activeTestPart.sections.map((section) => ({
45
+ ...section,
46
+ items: section.items.map(({ variables, ...rest }) => rest)
47
+ }))
48
+ };
49
+ const activeSection = augmentedTestPart.sections.find((section) => section.active);
50
+ const augmentedSection = { ...activeSection, items: activeSection.items };
51
+ const augmentedItem = augmentedSection.items.find((item) => item.active);
52
+ const { testParts, ...activeTest } = this.computedContext;
53
+ this.stampContext = {
54
+ test: activeTest,
55
+ testpart: augmentedTestPart,
56
+ section: augmentedSection,
57
+ item: augmentedItem
58
+ };
59
+ }
60
+ render() {
61
+ return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
62
+ ${this.stampContext && this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
63
+ }
64
+ };
65
+ __decorateClass([
66
+ property({ type: Boolean, reflect: true })
67
+ ], TestStamp.prototype, "debug", 2);
68
+ __decorateClass([
69
+ state(),
70
+ consume({ context: computedContext, subscribe: true })
71
+ ], TestStamp.prototype, "computedContext", 2);
72
+ __decorateClass([
73
+ state()
74
+ ], TestStamp.prototype, "stampContext", 2);
75
+ TestStamp = __decorateClass([
76
+ customElement("test-stamp")
77
+ ], TestStamp);
78
+
79
+ export {
80
+ TestStamp
81
+ };
82
+ //# sourceMappingURL=chunk-HL7H4ZGY.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 { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\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 test?: unknown;\n testpart?: unknown;\n section?: unknown;\n item?: unknown;\n } | null = null;\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\n const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);\n if (!activeTestPart) {\n this.stampContext = null;\n return;\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 activeSection = augmentedTestPart.sections.find(section => section.active);\n const augmentedSection = { ...activeSection, items: activeSection.items };\n\n const augmentedItem = augmentedSection.items.find(item => item.active);\n\n // if (!activeTestPart || !activeItem) {\n // this.stampContext = null;\n // return;\n // }\n\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n test: activeTest,\n testpart: augmentedTestPart,\n section: augmentedSection,\n item: augmentedItem\n };\n }\n\n render() {\n return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}\n ${this.stampContext && 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;AASjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAEL,SAAO,QAAQ;AAOf,SAAQ,eAKG;AAAA;AAAA,EAID,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;AAEA,UAAM,iBAAiB,KAAK,gBAAgB,UAAU,KAAK,cAAY,SAAS,MAAM;AACtF,QAAI,CAAC,gBAAgB;AACnB,WAAK,eAAe;AACpB;AAAA,IACF;AACA,UAAM,oBAAoB;AAAA,MACxB,GAAG;AAAA,MACH,OAAO,eAAe,SAAS,QAAQ,aAAW,QAAQ,MAAM,IAAI,CAAC,EAAE,WAAW,GAAG,KAAK,MAAM,IAAI,CAAC;AAAA,MACrG,UAAU,eAAe,SAAS,IAAI,cAAY;AAAA,QAChD,GAAG;AAAA,QACH,OAAO,QAAQ,MAAM,IAAI,CAAC,EAAE,WAAW,GAAG,KAAK,MAAM,IAAI;AAAA,MAC3D,EAAE;AAAA,IACJ;AAEA,UAAM,gBAAgB,kBAAkB,SAAS,KAAK,aAAW,QAAQ,MAAM;AAC/E,UAAM,mBAAmB,EAAE,GAAG,eAAe,OAAO,cAAc,MAAM;AAExE,UAAM,gBAAgB,iBAAiB,MAAM,KAAK,UAAQ,KAAK,MAAM;AAOrE,UAAM,EAAE,WAAW,GAAG,WAAW,IAAI,KAAK;AAE1C,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO,QAAQ,KAAK,QAAQ,mBAAmB,KAAK,UAAU,KAAK,cAAc,MAAM,CAAC,CAAC,mBAAmB,OAAO;AAAA,MACjH,KAAK,gBAAgB,KAAK,aAAa,KAAK,WAAW,KAAK,YAAY,IAAI,OAAO;AAAA,EACvF;AACF;AA1ES;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAD/B,UAEJ;AAIC;AAAA,EAFP,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAL3C,UAMH;AAGA;AAAA,EADP,MAAM;AAAA,GARI,UASH;AATG,YAAN;AAAA,EADN,cAAc,YAAY;AAAA,GACd;","names":[]}