@citolab/qti-components 7.3.1 → 7.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/cdn/chunks/chunk-2F7QLIQX.js +2 -0
  2. package/cdn/chunks/chunk-2FHBMRTL.js +10 -0
  3. package/cdn/chunks/chunk-2IPVI6JS.js +8 -0
  4. package/cdn/chunks/chunk-2MMQH3OR.js +8 -0
  5. package/cdn/chunks/chunk-3OIAVUFK.js +8 -0
  6. package/cdn/chunks/chunk-3XOKPK45.js +2 -0
  7. package/cdn/chunks/chunk-5DVOEPIP.js +8 -0
  8. package/cdn/chunks/chunk-5PA3GEIX.js +2 -0
  9. package/cdn/chunks/chunk-7JO3EE5V.js +5 -0
  10. package/cdn/chunks/chunk-AMH674XL.js +1450 -0
  11. package/cdn/chunks/chunk-C26NWYVO.js +2 -0
  12. package/cdn/chunks/chunk-C55DPNSW.js +8 -0
  13. package/cdn/chunks/chunk-CIIKVJF7.js +2 -0
  14. package/cdn/chunks/chunk-CMGZUMGV.js +2 -0
  15. package/cdn/chunks/chunk-DZTNCG5K.js +2 -0
  16. package/cdn/chunks/chunk-E7FZUPJ2.js +8 -0
  17. package/cdn/chunks/chunk-H3WTP2FL.js +2 -0
  18. package/cdn/chunks/chunk-IEHCQ5EK.js +2 -0
  19. package/cdn/chunks/chunk-LGSTDI7O.js +8 -0
  20. package/cdn/chunks/chunk-N3YBYEEI.js +2 -0
  21. package/cdn/chunks/chunk-N7K6VO7F.js +1 -0
  22. package/cdn/chunks/chunk-NPYS4GGN.js +5 -0
  23. package/cdn/chunks/chunk-OGZEE7T7.js +8 -0
  24. package/cdn/chunks/chunk-QA3FBQSF.js +5 -0
  25. package/cdn/chunks/chunk-QHO7IBHQ.js +2 -0
  26. package/cdn/chunks/chunk-QT25DBDO.js +8 -0
  27. package/cdn/chunks/chunk-SSBR2KEX.js +8 -0
  28. package/cdn/chunks/chunk-TB7NCJUL.js +8 -0
  29. package/cdn/chunks/chunk-UN2WT4WS.js +2 -0
  30. package/cdn/chunks/chunk-V6LLE3H4.js +8 -0
  31. package/cdn/chunks/chunk-X5K7LBUM.js +8 -0
  32. package/cdn/chunks/chunk-X6XRXEW2.js +2 -0
  33. package/cdn/chunks/chunk-Z6WP2K4O.js +1450 -0
  34. package/cdn/chunks/chunk-ZKETWB2E.js +8 -0
  35. package/cdn/index.global.js +1 -1
  36. package/cdn/index.js +1 -1
  37. package/cdn/qti-components/index.js +1 -1
  38. package/cdn/qti-test/components/index.js +1 -1
  39. package/cdn/qti-test/components/test-next.js +1 -1
  40. package/cdn/qti-test/components/test-prev.js +1 -1
  41. package/cdn/qti-test/components/test-scoring-feedback.js +1 -1
  42. package/cdn/qti-test/components/test-stamp.js +1 -1
  43. package/cdn/qti-test/core/index.js +1 -1
  44. package/dist/chunks/chunk-3IAZELYI.js +90 -0
  45. package/dist/chunks/chunk-3IAZELYI.js.map +1 -0
  46. package/dist/chunks/chunk-3YJPKRFS.js +91 -0
  47. package/dist/chunks/chunk-3YJPKRFS.js.map +1 -0
  48. package/dist/chunks/chunk-4PL7XU3H.js +82 -0
  49. package/dist/chunks/chunk-4PL7XU3H.js.map +1 -0
  50. package/dist/chunks/chunk-4YWF7QTH.js +92 -0
  51. package/dist/chunks/chunk-4YWF7QTH.js.map +1 -0
  52. package/dist/chunks/chunk-5AZFPSD4.js +87 -0
  53. package/dist/chunks/chunk-5AZFPSD4.js.map +1 -0
  54. package/dist/chunks/chunk-5OZP32ZZ.js +90 -0
  55. package/dist/chunks/chunk-5OZP32ZZ.js.map +1 -0
  56. package/dist/chunks/chunk-5SU6S5L4.js +94 -0
  57. package/dist/chunks/chunk-5SU6S5L4.js.map +1 -0
  58. package/dist/chunks/chunk-5WHKITF6.js +90 -0
  59. package/dist/chunks/chunk-5WHKITF6.js.map +1 -0
  60. package/dist/chunks/chunk-64JRMFTB.js +93 -0
  61. package/dist/chunks/chunk-64JRMFTB.js.map +1 -0
  62. package/dist/chunks/chunk-7RFWGVJR.js +109 -0
  63. package/dist/chunks/chunk-7RFWGVJR.js.map +1 -0
  64. package/dist/chunks/chunk-BAG5H6N2.js +7970 -0
  65. package/dist/chunks/chunk-BAG5H6N2.js.map +1 -0
  66. package/dist/chunks/chunk-CWT66FG4.js +95 -0
  67. package/dist/chunks/chunk-CWT66FG4.js.map +1 -0
  68. package/dist/chunks/chunk-F2JDNMKV.js +100 -0
  69. package/dist/chunks/chunk-F2JDNMKV.js.map +1 -0
  70. package/dist/chunks/chunk-F5OPIJ4X.js +90 -0
  71. package/dist/chunks/chunk-F5OPIJ4X.js.map +1 -0
  72. package/dist/chunks/chunk-FZHYC3TU.js +92 -0
  73. package/dist/chunks/chunk-FZHYC3TU.js.map +1 -0
  74. package/dist/chunks/chunk-GDNPYP37.js +85 -0
  75. package/dist/chunks/chunk-GDNPYP37.js.map +1 -0
  76. package/dist/chunks/chunk-H2HBYOZZ.js +90 -0
  77. package/dist/chunks/chunk-H2HBYOZZ.js.map +1 -0
  78. package/dist/chunks/chunk-H6RDLSTK.js +87 -0
  79. package/dist/chunks/chunk-H6RDLSTK.js.map +1 -0
  80. package/dist/chunks/chunk-IDRQNT6W.js +86 -0
  81. package/dist/chunks/chunk-IDRQNT6W.js.map +1 -0
  82. package/dist/chunks/chunk-KXDEFGCK.js +887 -0
  83. package/dist/chunks/chunk-KXDEFGCK.js.map +1 -0
  84. package/dist/chunks/chunk-KZAEUKGI.js +100 -0
  85. package/dist/chunks/chunk-KZAEUKGI.js.map +1 -0
  86. package/dist/chunks/chunk-LBL5YIK7.js +94 -0
  87. package/dist/chunks/chunk-LBL5YIK7.js.map +1 -0
  88. package/dist/chunks/chunk-LJ4KYDFF.js +56 -0
  89. package/dist/chunks/chunk-LJ4KYDFF.js.map +1 -0
  90. package/dist/chunks/chunk-LMMYXE6U.js +85 -0
  91. package/dist/chunks/chunk-LMMYXE6U.js.map +1 -0
  92. package/dist/chunks/chunk-MTWSJYVA.js +86 -0
  93. package/dist/chunks/chunk-MTWSJYVA.js.map +1 -0
  94. package/dist/chunks/chunk-OD6DYLAO.js +7940 -0
  95. package/dist/chunks/chunk-OD6DYLAO.js.map +1 -0
  96. package/dist/chunks/chunk-OLZSWYQO.js +100 -0
  97. package/dist/chunks/chunk-OLZSWYQO.js.map +1 -0
  98. package/dist/chunks/chunk-PI2VZUCF.js +91 -0
  99. package/dist/chunks/chunk-PI2VZUCF.js.map +1 -0
  100. package/dist/chunks/chunk-PRO3U224.js +91 -0
  101. package/dist/chunks/chunk-PRO3U224.js.map +1 -0
  102. package/dist/chunks/chunk-RZK54XLD.js +100 -0
  103. package/dist/chunks/chunk-RZK54XLD.js.map +1 -0
  104. package/dist/chunks/chunk-SBY26ONA.js +99 -0
  105. package/dist/chunks/chunk-SBY26ONA.js.map +1 -0
  106. package/dist/chunks/chunk-W7DAMVVM.js +90 -0
  107. package/dist/chunks/chunk-W7DAMVVM.js.map +1 -0
  108. package/dist/chunks/chunk-WH6TRM5K.js +82 -0
  109. package/dist/chunks/chunk-WH6TRM5K.js.map +1 -0
  110. package/dist/chunks/chunk-WLDX63OS.js +92 -0
  111. package/dist/chunks/chunk-WLDX63OS.js.map +1 -0
  112. package/dist/chunks/chunk-WTV3RW6F.js +91 -0
  113. package/dist/chunks/chunk-WTV3RW6F.js.map +1 -0
  114. package/dist/chunks/chunk-X5L7SQQN.js +887 -0
  115. package/dist/chunks/chunk-X5L7SQQN.js.map +1 -0
  116. package/dist/chunks/chunk-X5RBTIXP.js +86 -0
  117. package/dist/chunks/chunk-X5RBTIXP.js.map +1 -0
  118. package/dist/exports/computed-item.context.d.ts +1 -1
  119. package/dist/exports/computed.context.d.ts +2 -2
  120. package/dist/exports/interaction.d.ts +1 -1
  121. package/dist/exports/item.context.d.ts +1 -1
  122. package/dist/exports/qti-assessment-item.context.d.ts +1 -1
  123. package/dist/exports/qti-condition-expression.d.ts +1 -1
  124. package/dist/exports/qti-expression.d.ts +1 -1
  125. package/dist/exports/session.context.d.ts +2 -2
  126. package/dist/exports/test.context.d.ts +1 -1
  127. package/dist/exports/variables.d.ts +1 -1
  128. package/dist/index.d.ts +2 -2
  129. package/dist/index.js +6 -7
  130. package/dist/qti-components/index.d.ts +2 -2
  131. package/dist/qti-components/index.js +1 -2
  132. package/dist/qti-components-jsx.d.ts +73 -12
  133. package/dist/qti-item/components/item-show-correct-response.d.ts +1 -1
  134. package/dist/qti-item/components/print-item-variables.d.ts +1 -1
  135. package/dist/qti-item/core/index.d.ts +1 -1
  136. package/dist/qti-loader/index.d.ts +1 -1
  137. package/dist/qti-response-declaration-pCFZA_aW.d.ts +1356 -0
  138. package/dist/qti-test/components/index.d.ts +2 -2
  139. package/dist/qti-test/components/index.js +4 -5
  140. package/dist/qti-test/components/test-navigation.d.ts +2 -2
  141. package/dist/qti-test/components/test-next.d.ts +14 -16
  142. package/dist/qti-test/components/test-next.js +1 -1
  143. package/dist/qti-test/components/test-prev.d.ts +16 -18
  144. package/dist/qti-test/components/test-prev.js +1 -3
  145. package/dist/qti-test/components/test-print-context.d.ts +2 -2
  146. package/dist/qti-test/components/test-print-item-variables.d.ts +2 -2
  147. package/dist/qti-test/components/test-scoring-buttons.d.ts +2 -2
  148. package/dist/qti-test/components/test-scoring-feedback.d.ts +2 -2
  149. package/dist/qti-test/components/test-scoring-feedback.js +1 -1
  150. package/dist/qti-test/components/test-show-correct-response.d.ts +2 -2
  151. package/dist/qti-test/components/test-stamp.d.ts +2 -2
  152. package/dist/qti-test/components/test-stamp.js +1 -1
  153. package/dist/qti-test/core/index.d.ts +3 -3
  154. package/dist/qti-test/core/index.js +2 -3
  155. package/dist/qti-test-feedback-2xjKezsY.d.ts +85 -0
  156. package/dist/vscode.html-custom-data.json +39 -15
  157. package/package.json +1 -1
@@ -0,0 +1,90 @@
1
+ import {
2
+ computedContext
3
+ } from "./chunk-AZIKAG7K.js";
4
+ import {
5
+ __decorateClass
6
+ } from "./chunk-H2JE6IVU.js";
7
+
8
+ // src/lib/qti-test/components/test-stamp.ts
9
+ import { html, LitElement, nothing } from "lit";
10
+ import { customElement, property, state } from "lit/decorators.js";
11
+ import { prepareTemplate } from "stampino";
12
+ import { consume } from "@lit/context";
13
+ var TestStamp = class extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.debug = false;
17
+ this.stampContext = {
18
+ view: "candidate",
19
+ activeItem: {},
20
+ activeSection: {
21
+ items: []
22
+ },
23
+ activeTestpart: {
24
+ items: []
25
+ },
26
+ test: {}
27
+ };
28
+ }
29
+ createRenderRoot() {
30
+ return this;
31
+ }
32
+ connectedCallback() {
33
+ super.connectedCallback();
34
+ const templateElement = this.querySelector("template");
35
+ if (!templateElement) {
36
+ this.myTemplate = null;
37
+ return;
38
+ }
39
+ this.myTemplate = prepareTemplate(templateElement);
40
+ }
41
+ willUpdate(_changedProperties) {
42
+ if (!this.computedContext) {
43
+ this.stampContext = null;
44
+ return;
45
+ }
46
+ const activeTestPart = this.computedContext.testParts.find((testPart) => testPart.active);
47
+ const activeSection = activeTestPart?.sections.find((section) => section.active);
48
+ const activeItem = activeSection?.items.find((item) => item.active);
49
+ const { variables, ...augmentedItem } = activeItem || {};
50
+ const augmentedTestPart = {
51
+ ...activeTestPart,
52
+ items: activeTestPart.sections.flatMap((section) => section.items.map(({ variables: variables2, ...rest }) => rest)),
53
+ sections: activeTestPart.sections.map((section) => ({
54
+ ...section,
55
+ items: section.items.map(({ variables: variables2, ...rest }) => rest)
56
+ }))
57
+ };
58
+ const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables: variables2, ...rest }) => rest) };
59
+ const { testParts, ...activeTest } = this.computedContext;
60
+ this.stampContext = {
61
+ view: this.computedContext.view,
62
+ activeItem: augmentedItem,
63
+ activeSection: augmentedSection,
64
+ activeTestpart: augmentedTestPart,
65
+ test: activeTest
66
+ };
67
+ }
68
+ render() {
69
+ return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
70
+ ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
71
+ }
72
+ };
73
+ __decorateClass([
74
+ property({ type: Boolean, reflect: true })
75
+ ], TestStamp.prototype, "debug", 2);
76
+ __decorateClass([
77
+ state(),
78
+ consume({ context: computedContext, subscribe: true })
79
+ ], TestStamp.prototype, "computedContext", 2);
80
+ __decorateClass([
81
+ state()
82
+ ], TestStamp.prototype, "stampContext", 2);
83
+ TestStamp = __decorateClass([
84
+ customElement("test-stamp")
85
+ ], TestStamp);
86
+
87
+ export {
88
+ TestStamp
89
+ };
90
+ //# sourceMappingURL=chunk-5OZP32ZZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-stamp.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { prepareTemplate } from 'stampino';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { View } from '../core/mixins/test-view.mixin';\nimport type { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n/**\n * A custom web component that renders a test stamp using the Lit framework.\n * This component is deprecated and will be removed in the future.\n * @customElement\n * @extends {LitElement}\n */\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\n /**\n * Indicates whether the component is in debug mode.\n * When set to `true`, the available objects and properties (i.e.: stampContext) is displayed.\n */\n @property({ type: Boolean, reflect: true })\n public debug = false;\n\n @state()\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n @state()\n private stampContext: {\n view?: View;\n test?: unknown;\n activeTestpart?: unknown;\n activeSection?: unknown;\n activeItem?: unknown;\n } = {\n view: 'candidate',\n activeItem: {},\n activeSection: {\n items: []\n },\n activeTestpart: {\n items: []\n },\n test: {}\n };\n\n myTemplate: TemplateFunction;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n const templateElement = this.querySelector<HTMLTemplateElement>('template');\n if (!templateElement) {\n this.myTemplate = null;\n return;\n }\n this.myTemplate = prepareTemplate(templateElement);\n }\n\n protected willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) {\n this.stampContext = null;\n return;\n }\n const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);\n const activeSection = activeTestPart?.sections.find(section => section.active);\n const activeItem = activeSection?.items.find(item => item.active);\n const { variables, ...augmentedItem } = activeItem || {};\n\n const augmentedTestPart = {\n ...activeTestPart,\n items: activeTestPart.sections.flatMap(section => section.items.map(({ variables, ...rest }) => rest)),\n sections: activeTestPart.sections.map(section => ({\n ...section,\n items: section.items.map(({ variables, ...rest }) => rest)\n }))\n };\n\n const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables, ...rest }) => rest) };\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n view: this.computedContext.view,\n activeItem: augmentedItem,\n activeSection: augmentedSection,\n activeTestpart: augmentedTestPart,\n test: activeTest\n };\n }\n\n render() {\n // if (!this.stampContext) return nothing;\n return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}\n ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-stamp': TestStamp;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,YAAY,eAAe;AAC1C,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,uBAAuB;AAChC,SAAS,eAAe;AAgBjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAML,SAAO,QAAQ;AAOf,SAAQ,eAMJ;AAAA,MACF,MAAM;AAAA,MACN,YAAY,CAAC;AAAA,MACb,eAAe;AAAA,QACb,OAAO,CAAC;AAAA,MACV;AAAA,MACA,gBAAgB;AAAA,QACd,OAAO,CAAC;AAAA,MACV;AAAA,MACA,MAAM,CAAC;AAAA,IACT;AAAA;A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WAAO,QAAQ,KAAK,QAAQ,mBAAmB,KAAK,UAAU,KAAK,cAAc,MAAM,CAAC,CAAC,mBAAmB,OAAO;AAAA,MACjH,KAAK,aAAa,KAAK,WAAW,KAAK,YAAY,IAAI,OAAO;AAAA,EAClE;AACF;AA7ES;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,94 @@
1
+ import {
2
+ computedContext
3
+ } from "./chunk-AZIKAG7K.js";
4
+ import {
5
+ __decorateClass
6
+ } from "./chunk-H2JE6IVU.js";
7
+
8
+ // src/lib/qti-test/components/test-stamp.ts
9
+ import { html, LitElement, nothing } from "lit";
10
+ import { customElement, property, state } from "lit/decorators.js";
11
+ import { prepareTemplate } from "stampino";
12
+ import { consume } from "@lit/context";
13
+ var TestStamp = class extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.debug = false;
17
+ this.stampContext = {
18
+ view: "candidate",
19
+ activeItem: {},
20
+ activeSection: {
21
+ items: []
22
+ },
23
+ activeTestpart: {
24
+ items: [],
25
+ 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
+ console.log("activeTestPart", activeTestPart);
62
+ const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables: variables2, ...rest }) => rest) };
63
+ const { testParts, ...activeTest } = this.computedContext;
64
+ this.stampContext = {
65
+ view: this.computedContext.view,
66
+ activeItem: augmentedItem,
67
+ activeSection: augmentedSection,
68
+ activeTestpart: augmentedTestPart,
69
+ test: activeTest
70
+ };
71
+ }
72
+ render() {
73
+ return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
74
+ ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
75
+ }
76
+ };
77
+ __decorateClass([
78
+ property({ type: Boolean, reflect: true })
79
+ ], TestStamp.prototype, "debug", 2);
80
+ __decorateClass([
81
+ state(),
82
+ consume({ context: computedContext, subscribe: true })
83
+ ], TestStamp.prototype, "computedContext", 2);
84
+ __decorateClass([
85
+ state()
86
+ ], TestStamp.prototype, "stampContext", 2);
87
+ TestStamp = __decorateClass([
88
+ customElement("test-stamp")
89
+ ], TestStamp);
90
+
91
+ export {
92
+ TestStamp
93
+ };
94
+ //# sourceMappingURL=chunk-5SU6S5L4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-stamp.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { prepareTemplate } from 'stampino';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { View } from '../core/mixins/test-view.mixin';\nimport type { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n/**\n * A custom web component that renders a test stamp using the Lit framework.\n * This component is deprecated and will be removed in the future.\n * @customElement\n * @extends {LitElement}\n */\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\n /**\n * Indicates whether the component is in debug mode.\n * When set to `true`, the available objects and properties (i.e.: stampContext) is displayed.\n */\n @property({ type: Boolean, reflect: true })\n public debug = false;\n\n @state()\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n @state()\n private stampContext: {\n view?: View;\n test?: unknown;\n activeTestpart?: unknown;\n activeSection?: unknown;\n activeItem?: unknown;\n } = {\n view: 'candidate',\n activeItem: {},\n activeSection: {\n items: []\n },\n activeTestpart: {\n items: [],\n 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 console.log('activeTestPart', activeTestPart);\n\n const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables, ...rest }) => rest) };\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n view: this.computedContext.view,\n activeItem: augmentedItem,\n activeSection: augmentedSection,\n activeTestpart: augmentedTestPart,\n test: activeTest\n };\n }\n\n render() {\n // if (!this.stampContext) return nothing;\n return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}\n ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-stamp': TestStamp;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,YAAY,eAAe;AAC1C,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,uBAAuB;AAChC,SAAS,eAAe;AAgBjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAML,SAAO,QAAQ;AAOf,SAAQ,eAMJ;AAAA,MACF,MAAM;AAAA,MACN,YAAY,CAAC;AAAA,MACb,eAAe;AAAA,QACb,OAAO,CAAC;AAAA,MACV;AAAA,MACA,gBAAgB;AAAA,QACd,OAAO,CAAC;AAAA,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;AACpB,WAAK,aAAa;AAClB;AAAA,IACF;AACA,SAAK,aAAa,gBAAgB,eAAe;AAAA,EACnD;AAAA,EAEU,WAAW,oBAA0C;AAC7D,QAAI,CAAC,KAAK,iBAAiB;AACzB;AAAA,IACF;AACA,UAAM,iBAAiB,KAAK,gBAAgB,UAAU,KAAK,cAAY,SAAS,MAAM;AACtF,UAAM,gBAAgB,gBAAgB,SAAS,KAAK,aAAW,QAAQ,MAAM;AAC7E,UAAM,aAAa,eAAe,MAAM,KAAK,UAAQ,KAAK,MA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AAN;AAAA,EADN,cAAc,YAAY;AAAA,GACd;","names":["variables"]}
@@ -0,0 +1,90 @@
1
+ import {
2
+ computedContext
3
+ } from "./chunk-AZIKAG7K.js";
4
+ import {
5
+ __decorateClass
6
+ } from "./chunk-H2JE6IVU.js";
7
+
8
+ // src/lib/qti-test/components/test-stamp.ts
9
+ import { html, LitElement, nothing } from "lit";
10
+ import { customElement, property, state } from "lit/decorators.js";
11
+ import { prepareTemplate } from "stampino";
12
+ import { consume } from "@lit/context";
13
+ var TestStamp = class extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.debug = false;
17
+ this.stampContext = {
18
+ view: "candidate",
19
+ activeItem: {},
20
+ activeSection: {
21
+ items: []
22
+ },
23
+ activeTestpart: {
24
+ items: []
25
+ },
26
+ test: {}
27
+ };
28
+ }
29
+ createRenderRoot() {
30
+ return this;
31
+ }
32
+ connectedCallback() {
33
+ super.connectedCallback();
34
+ const templateElement = this.querySelector("template");
35
+ if (!templateElement) {
36
+ this.myTemplate = null;
37
+ return;
38
+ }
39
+ this.myTemplate = prepareTemplate(templateElement);
40
+ }
41
+ willUpdate(_changedProperties) {
42
+ if (!this.computedContext) {
43
+ this.stampContext = null;
44
+ return;
45
+ }
46
+ const activeTestPart = this.computedContext.testParts.find((testPart) => testPart.active);
47
+ const activeSection = activeTestPart?.sections.find((section) => section.active);
48
+ const activeItem = activeSection?.items.find((item) => item.active);
49
+ const { variables, ...augmentedItem } = activeItem || {};
50
+ const augmentedTestPart = {
51
+ ...activeTestPart,
52
+ items: activeTestPart.sections.flatMap((section) => section.items.map(({ variables: variables2, ...rest }) => rest)),
53
+ sections: activeTestPart.sections.map((section) => ({
54
+ ...section,
55
+ items: section.items.map(({ variables: variables2, ...rest }) => rest) || []
56
+ }))
57
+ };
58
+ const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables: variables2, ...rest }) => rest) };
59
+ const { testParts, ...activeTest } = this.computedContext;
60
+ this.stampContext = {
61
+ view: this.computedContext.view,
62
+ activeItem: augmentedItem,
63
+ activeSection: augmentedSection,
64
+ activeTestpart: augmentedTestPart,
65
+ test: activeTest
66
+ };
67
+ }
68
+ render() {
69
+ return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
70
+ ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
71
+ }
72
+ };
73
+ __decorateClass([
74
+ property({ type: Boolean, reflect: true })
75
+ ], TestStamp.prototype, "debug", 2);
76
+ __decorateClass([
77
+ state(),
78
+ consume({ context: computedContext, subscribe: true })
79
+ ], TestStamp.prototype, "computedContext", 2);
80
+ __decorateClass([
81
+ state()
82
+ ], TestStamp.prototype, "stampContext", 2);
83
+ TestStamp = __decorateClass([
84
+ customElement("test-stamp")
85
+ ], TestStamp);
86
+
87
+ export {
88
+ TestStamp
89
+ };
90
+ //# sourceMappingURL=chunk-5WHKITF6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-stamp.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { prepareTemplate } from 'stampino';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { View } from '../core/mixins/test-view.mixin';\nimport type { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n/**\n * A custom web component that renders a test stamp using the Lit framework.\n * This component is deprecated and will be removed in the future.\n * @customElement\n * @extends {LitElement}\n */\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\n /**\n * Indicates whether the component is in debug mode.\n * When set to `true`, the available objects and properties (i.e.: stampContext) is displayed.\n */\n @property({ type: Boolean, reflect: true })\n public debug = false;\n\n @state()\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n @state()\n private stampContext: {\n view?: View;\n test?: unknown;\n activeTestpart?: unknown;\n activeSection?: unknown;\n activeItem?: unknown;\n } = {\n view: 'candidate',\n activeItem: {},\n activeSection: {\n items: []\n },\n activeTestpart: {\n items: []\n },\n test: {}\n };\n\n myTemplate: TemplateFunction;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n const templateElement = this.querySelector<HTMLTemplateElement>('template');\n if (!templateElement) {\n this.myTemplate = null;\n return;\n }\n this.myTemplate = prepareTemplate(templateElement);\n }\n\n protected willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) {\n this.stampContext = null;\n return;\n }\n const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);\n const activeSection = activeTestPart?.sections.find(section => section.active);\n const activeItem = activeSection?.items.find(item => item.active);\n const { variables, ...augmentedItem } = activeItem || {};\n\n // 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\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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E,WAAAA,YAAW,GAAG,KAAK,MAAM,IAAI,EAAE;AAC9G,UAAM,EAAE,WAAW,GAAG,WAAW,IAAI,KAAK;AAE1C,SAAK,eAAe;AAAA,MAClB,MAAM,KAAK,gBAAgB;AAAA,MAC3B,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,gBAAgB;AAAA,MAChB,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,SAAS;AAEP,WAAO,QAAQ,KAAK,QAAQ,mBAAmB,KAAK,UAAU,KAAK,cAAc,MAAM,CAAC,CAAC,mBAAmB,OAAO;AAAA,MACjH,KAAK,aAAa,KAAK,WAAW,KAAK,YAAY,IAAI,OAAO;AAAA,EAClE;AACF;AAlFS;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,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 "stampino";
12
+ import { consume } from "@lit/context";
13
+ var TestStamp = class extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.debug = false;
17
+ this.stampContext = {
18
+ view: "candidate",
19
+ activeItem: {},
20
+ activeSection: {
21
+ items: []
22
+ },
23
+ activeTestpart: {
24
+ items: [],
25
+ 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-64JRMFTB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-stamp.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { prepareTemplate } from 'stampino';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { View } from '../core/mixins/test-view.mixin';\nimport type { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n/**\n * A custom web component that renders a test stamp using the Lit framework.\n * This component is deprecated and will be removed in the future.\n * @customElement\n * @extends {LitElement}\n */\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\n /**\n * Indicates whether the component is in debug mode.\n * When set to `true`, the available objects and properties (i.e.: stampContext) is displayed.\n */\n @property({ type: Boolean, reflect: true })\n public debug = false;\n\n @state()\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n @state()\n private stampContext: {\n view?: View;\n test?: unknown;\n activeTestpart?: unknown;\n activeSection?: unknown;\n activeItem?: unknown;\n } = {\n view: 'candidate',\n activeItem: {},\n activeSection: {\n items: []\n },\n activeTestpart: {\n items: [],\n 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;AACpB,WAAK,aAAa;AAClB;AAAA,IACF;AACA,SAAK,aAAa,gBAAgB,eAAe;AAAA,EACnD;AAAA,EAEU,WAAW,oBAA0C;AAC7D,QAAI,CA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K,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,109 @@
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 as property2, state } from "lit/decorators.js";
18
+ import { consume } from "@lit/context";
19
+
20
+ // src/lib/decorators/prop-internal-state.ts
21
+ import { property } from "lit/decorators.js";
22
+
23
+ // src/lib/qti-test/components/test-prev.ts
24
+ var TestPrev = class extends LitElement {
25
+ constructor() {
26
+ super();
27
+ this.disabled = true;
28
+ this._internallyDisabled = true;
29
+ this._internals = this.attachInternals();
30
+ this._internals.role = "button";
31
+ this._internals.ariaLabel = "Previous item";
32
+ this.addEventListener("click", (e) => {
33
+ e.preventDefault();
34
+ if (!this.effectiveDisabled) {
35
+ this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);
36
+ }
37
+ });
38
+ }
39
+ // Computed effective state
40
+ get effectiveDisabled() {
41
+ return this._internallyDisabled || this.disabled;
42
+ }
43
+ updated() {
44
+ if (this.effectiveDisabled) {
45
+ this.setAttribute("effective-disabled", "");
46
+ } else {
47
+ this.removeAttribute("effective-disabled");
48
+ }
49
+ }
50
+ _handleTestElementChange(_oldValue, newValue) {
51
+ if (newValue) {
52
+ this.disabled = false;
53
+ }
54
+ }
55
+ willUpdate(_changedProperties) {
56
+ if (!this.computedContext) return;
57
+ const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
58
+ if (!testPart) return;
59
+ this.sectionItems = testPart.sections.flatMap((section) => section.items);
60
+ this.itemIndex = this.sectionItems.findIndex((item) => item.active);
61
+ this.checkDisabled();
62
+ }
63
+ checkDisabled() {
64
+ this._internallyDisabled = !this.computedContext || this.itemIndex <= 0 || this.itemIndex === -1;
65
+ }
66
+ _requestItem(identifier) {
67
+ this.dispatchEvent(
68
+ new CustomEvent("qti-request-navigation", {
69
+ composed: true,
70
+ bubbles: true,
71
+ detail: {
72
+ type: "item",
73
+ id: identifier
74
+ }
75
+ })
76
+ );
77
+ }
78
+ render() {
79
+ return html`<slot></slot>`;
80
+ }
81
+ };
82
+ TestPrev.styles = css`
83
+ :host {
84
+ ${btn};
85
+ }
86
+ :host([effective-disabled]) {
87
+ ${dis};
88
+ }
89
+ `;
90
+ __decorateClass([
91
+ property2({ type: Boolean, reflect: true })
92
+ ], TestPrev.prototype, "disabled", 2);
93
+ __decorateClass([
94
+ state()
95
+ ], TestPrev.prototype, "_internallyDisabled", 2);
96
+ __decorateClass([
97
+ consume({ context: computedContext, subscribe: true })
98
+ ], TestPrev.prototype, "computedContext", 2);
99
+ __decorateClass([
100
+ watch("computedContext")
101
+ ], TestPrev.prototype, "_handleTestElementChange", 1);
102
+ TestPrev = __decorateClass([
103
+ customElement("test-prev")
104
+ ], TestPrev);
105
+
106
+ export {
107
+ TestPrev
108
+ };
109
+ //# sourceMappingURL=chunk-7RFWGVJR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-prev.ts","../../src/lib/decorators/prop-internal-state.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport * as styles from './styles';\nimport { watch } from '../../decorators';\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedContext, ComputedItem } from '../../exports/computed.context';\n\n@customElement('test-prev')\nexport class TestPrev extends LitElement {\n // External control\n @property({ type: Boolean, reflect: true })\n public disabled = true;\n\n // Internal logic override\n @state()\n private _internallyDisabled = true;\n\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n sectionItems: ComputedItem[];\n itemIndex: number;\n\n static styles = css`\n :host {\n ${styles.btn};\n }\n :host([effective-disabled]) {\n ${styles.dis};\n }\n `;\n\n private _internals: ElementInternals;\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n this._internals.role = 'button';\n this._internals.ariaLabel = 'Previous item';\n\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this.effectiveDisabled) {\n this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);\n }\n });\n }\n\n // Computed effective state\n get effectiveDisabled() {\n return this._internallyDisabled || this.disabled;\n }\n\n updated() {\n // Reflect effective state as attribute for styling\n if (this.effectiveDisabled) {\n this.setAttribute('effective-disabled', '');\n } else {\n this.removeAttribute('effective-disabled');\n }\n }\n\n @watch('computedContext')\n _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {\n if (newValue) {\n this.disabled = false;\n }\n }\n\n willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n if (!this.computedContext) return;\n\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n if (!testPart) return;\n\n this.sectionItems = testPart.sections.flatMap(section => section.items);\n this.itemIndex = this.sectionItems.findIndex(item => item.active);\n\n this.checkDisabled();\n }\n\n checkDisabled() {\n this._internallyDisabled = !this.computedContext || this.itemIndex <= 0 || this.itemIndex === -1;\n }\n\n protected _requestItem(identifier: string): void {\n this.dispatchEvent(\n new CustomEvent('qti-request-navigation', {\n composed: true,\n bubbles: true,\n detail: {\n type: 'item',\n id: identifier\n }\n })\n );\n }\n\n render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-prev': TestPrev;\n }\n}\n","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,KAAK,MAAM,kBAAkB;AACtC,SAAS,eAAe,YAAAA,WAAU,aAAa;AAC/C,SAAS,eAAe;;;ACFxB,SAAS,gBAAgB;;;ADWlB,IAAM,WAAN,cAAuB,WAAW;AAAA,EA0BvC,cAAc;AACZ,UAAM;AAxBR,SAAO,WAAW;AAIlB,SAAQ,sBAAsB;AAqB5B,SAAK,aAAa,KAAK,gBAAgB;AACvC,SAAK,WAAW,OAAO;AACvB,SAAK,WAAW,YAAY;AAE5B,SAAK,iBAAiB,SAAS,OAAK;AAClC,QAAE,eAAe;AACjB,UAAI,CAAC,KAAK,mBAAmB;AAC3B,aAAK,aAAa,KAAK,aAAa,KAAK,YAAY,CAAC,EAAE,UAAU;AAAA,MACpE;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA,EAG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