@citolab/qti-components 7.3.1 → 7.3.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 (53) hide show
  1. package/cdn/chunks/chunk-2F7QLIQX.js +2 -0
  2. package/cdn/chunks/chunk-3XOKPK45.js +2 -0
  3. package/cdn/chunks/chunk-5PA3GEIX.js +2 -0
  4. package/cdn/chunks/chunk-C26NWYVO.js +2 -0
  5. package/cdn/chunks/chunk-CIIKVJF7.js +2 -0
  6. package/cdn/chunks/chunk-CMGZUMGV.js +2 -0
  7. package/cdn/chunks/chunk-DZTNCG5K.js +2 -0
  8. package/cdn/chunks/chunk-H3WTP2FL.js +2 -0
  9. package/cdn/chunks/chunk-IEHCQ5EK.js +2 -0
  10. package/cdn/chunks/chunk-N3YBYEEI.js +2 -0
  11. package/cdn/chunks/chunk-QHO7IBHQ.js +2 -0
  12. package/cdn/chunks/chunk-UN2WT4WS.js +2 -0
  13. package/cdn/chunks/chunk-X6XRXEW2.js +2 -0
  14. package/cdn/index.js +1 -1
  15. package/cdn/qti-test/components/index.js +1 -1
  16. package/cdn/qti-test/components/test-stamp.js +1 -1
  17. package/dist/chunks/chunk-3IAZELYI.js +90 -0
  18. package/dist/chunks/chunk-3IAZELYI.js.map +1 -0
  19. package/dist/chunks/chunk-3YJPKRFS.js +91 -0
  20. package/dist/chunks/chunk-3YJPKRFS.js.map +1 -0
  21. package/dist/chunks/chunk-5AZFPSD4.js +87 -0
  22. package/dist/chunks/chunk-5AZFPSD4.js.map +1 -0
  23. package/dist/chunks/chunk-5OZP32ZZ.js +90 -0
  24. package/dist/chunks/chunk-5OZP32ZZ.js.map +1 -0
  25. package/dist/chunks/chunk-5SU6S5L4.js +94 -0
  26. package/dist/chunks/chunk-5SU6S5L4.js.map +1 -0
  27. package/dist/chunks/chunk-5WHKITF6.js +90 -0
  28. package/dist/chunks/chunk-5WHKITF6.js.map +1 -0
  29. package/dist/chunks/chunk-64JRMFTB.js +93 -0
  30. package/dist/chunks/chunk-64JRMFTB.js.map +1 -0
  31. package/dist/chunks/chunk-F5OPIJ4X.js +90 -0
  32. package/dist/chunks/chunk-F5OPIJ4X.js.map +1 -0
  33. package/dist/chunks/chunk-H2HBYOZZ.js +90 -0
  34. package/dist/chunks/chunk-H2HBYOZZ.js.map +1 -0
  35. package/dist/chunks/chunk-H6RDLSTK.js +87 -0
  36. package/dist/chunks/chunk-H6RDLSTK.js.map +1 -0
  37. package/dist/chunks/chunk-IDRQNT6W.js +86 -0
  38. package/dist/chunks/chunk-IDRQNT6W.js.map +1 -0
  39. package/dist/chunks/chunk-LBL5YIK7.js +94 -0
  40. package/dist/chunks/chunk-LBL5YIK7.js.map +1 -0
  41. package/dist/chunks/chunk-MTWSJYVA.js +86 -0
  42. package/dist/chunks/chunk-MTWSJYVA.js.map +1 -0
  43. package/dist/chunks/chunk-PRO3U224.js +91 -0
  44. package/dist/chunks/chunk-PRO3U224.js.map +1 -0
  45. package/dist/chunks/chunk-W7DAMVVM.js +90 -0
  46. package/dist/chunks/chunk-W7DAMVVM.js.map +1 -0
  47. package/dist/chunks/chunk-WTV3RW6F.js +91 -0
  48. package/dist/chunks/chunk-WTV3RW6F.js.map +1 -0
  49. package/dist/index.js +1 -1
  50. package/dist/qti-test/components/index.js +1 -1
  51. package/dist/qti-test/components/test-stamp.d.ts +2 -2
  52. package/dist/qti-test/components/test-stamp.js +1 -1
  53. package/package.json +1 -1
@@ -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;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B,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;AAnFS;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,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,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAML,SAAO,QAAQ;AAOf,SAAQ,eAMJ;AAAA,MACF,MAAM;AAAA,MACN,YAAY,CAAC;AAAA,MACb,eAAe;AAAA,QACb,OAAO,CAAC;AAAA,MACV;AAAA,MACA,gBAAgB;AAAA,QACd,OAAO,CAAC;AAAA,MACV;AAAA,MACA,MAAM,CAAC;AAAA,IACT;AAAA;AAAA,EAIU,mBAAmD;AAC3D,WAAO;AAAA,EACT;AAAA,EAEA,oBAA0B;AACxB,UAAM,kBAAkB;AACxB,UAAM,kBAAkB,KAAK,cAAmC,UAAU;AAC1E,QAAI,CAAC,iBAAiB;AACpB,WAAK,aAAa;AAClB;AAAA,IACF;AACA,SAAK,aAAa,gBAAgB,eAAe;AAAA,EACnD;AAAA,EAEU,WAAW,oBAA0C;AAC7D,QAAI,CAAC,KAAK,iBAAiB;AACzB,WAAK,eAAe;AACpB;AAAA,IACF;AACA,UAAM,iBAAiB,KAAK,gBAAgB,UAAU,KAAK,cAAY,SAAS,MAAM;AACtF,UAAM,gBAAgB,gBAAgB,SAAS,KAAK,aAAW,QAAQ,MAAM;AAC7E,UAAM,aAAa,eAAe,MAAM,KAAK,UAAQ,KAAK,MAAM;AAChE,UAAM,EAAE,W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
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,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AI,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;AAjFS;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAL/B,UAMJ;AAIC;AAAA,EAFP,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAT3C,UAUH;AAGA;AAAA,EADP,MAAM;AAAA,GAZI,UAaH;AAbG,YAAN;AAAA,EADN,cAAc,YAAY;AAAA,GACd;","names":["variables"]}
@@ -0,0 +1,90 @@
1
+ import {
2
+ computedContext
3
+ } from "./chunk-AZIKAG7K.js";
4
+ import {
5
+ __decorateClass
6
+ } from "./chunk-H2JE6IVU.js";
7
+
8
+ // src/lib/qti-test/components/test-stamp.ts
9
+ import { html, LitElement, nothing } from "lit";
10
+ import { customElement, property, state } from "lit/decorators.js";
11
+ import { prepareTemplate } from "stampino";
12
+ import { consume } from "@lit/context";
13
+ var TestStamp = class extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.debug = false;
17
+ this.stampContext = {
18
+ view: "candidate",
19
+ activeItem: {},
20
+ activeSection: {
21
+ items: []
22
+ },
23
+ activeTestpart: {
24
+ items: []
25
+ },
26
+ test: {}
27
+ };
28
+ }
29
+ createRenderRoot() {
30
+ return this;
31
+ }
32
+ connectedCallback() {
33
+ super.connectedCallback();
34
+ const templateElement = this.querySelector("template");
35
+ if (!templateElement) {
36
+ this.myTemplate = null;
37
+ return;
38
+ }
39
+ this.myTemplate = prepareTemplate(templateElement);
40
+ }
41
+ willUpdate(_changedProperties) {
42
+ if (!this.computedContext) {
43
+ this.stampContext = null;
44
+ return;
45
+ }
46
+ const activeTestPart = this.computedContext.testParts.find((testPart) => testPart.active);
47
+ const activeSection = activeTestPart?.sections?.find((section) => section.active);
48
+ const activeItem = activeSection?.items.find((item) => item.active);
49
+ const { variables, ...augmentedItem } = activeItem || {};
50
+ const augmentedTestPart = {
51
+ ...activeTestPart,
52
+ items: activeTestPart.sections.flatMap((section) => section.items.map(({ variables: variables2, ...rest }) => rest)),
53
+ sections: activeTestPart.sections.map((section) => ({
54
+ ...section,
55
+ items: section.items.map(({ variables: variables2, ...rest }) => rest)
56
+ }))
57
+ };
58
+ const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables: variables2, ...rest }) => rest) };
59
+ const { testParts, ...activeTest } = this.computedContext;
60
+ this.stampContext = {
61
+ view: this.computedContext.view,
62
+ activeItem: augmentedItem,
63
+ activeSection: augmentedSection,
64
+ activeTestpart: augmentedTestPart,
65
+ test: activeTest
66
+ };
67
+ }
68
+ render() {
69
+ return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
70
+ ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
71
+ }
72
+ };
73
+ __decorateClass([
74
+ property({ type: Boolean, reflect: true })
75
+ ], TestStamp.prototype, "debug", 2);
76
+ __decorateClass([
77
+ state(),
78
+ consume({ context: computedContext, subscribe: true })
79
+ ], TestStamp.prototype, "computedContext", 2);
80
+ __decorateClass([
81
+ state()
82
+ ], TestStamp.prototype, "stampContext", 2);
83
+ TestStamp = __decorateClass([
84
+ customElement("test-stamp")
85
+ ], TestStamp);
86
+
87
+ export {
88
+ TestStamp
89
+ };
90
+ //# sourceMappingURL=chunk-F5OPIJ4X.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-stamp.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { prepareTemplate } from 'stampino';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { View } from '../core/mixins/test-view.mixin';\nimport type { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n/**\n * A custom web component that renders a test stamp using the Lit framework.\n * This component is deprecated and will be removed in the future.\n * @customElement\n * @extends {LitElement}\n */\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\n /**\n * Indicates whether the component is in debug mode.\n * When set to `true`, the available objects and properties (i.e.: stampContext) is displayed.\n */\n @property({ type: Boolean, reflect: true })\n public debug = false;\n\n @state()\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n @state()\n private stampContext: {\n view?: View;\n test?: unknown;\n activeTestpart?: unknown;\n activeSection?: unknown;\n activeItem?: unknown;\n } = {\n view: 'candidate',\n activeItem: {},\n activeSection: {\n items: []\n },\n activeTestpart: {\n items: []\n },\n test: {}\n };\n\n myTemplate: TemplateFunction;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n const templateElement = this.querySelector<HTMLTemplateElement>('template');\n if (!templateElement) {\n this.myTemplate = null;\n return;\n }\n this.myTemplate = prepareTemplate(templateElement);\n }\n\n protected willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) {\n this.stampContext = null;\n return;\n }\n const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);\n const activeSection = activeTestPart?.sections?.find(section => section.active);\n const activeItem = activeSection?.items.find(item => item.active);\n const { variables, ...augmentedItem } = activeItem || {};\n\n const augmentedTestPart = {\n ...activeTestPart,\n items: activeTestPart.sections.flatMap(section => section.items.map(({ variables, ...rest }) => rest)),\n sections: activeTestPart.sections.map(section => ({\n ...section,\n items: section.items.map(({ variables, ...rest }) => rest)\n }))\n };\n\n const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables, ...rest }) => rest) };\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n view: this.computedContext.view,\n activeItem: augmentedItem,\n activeSection: augmentedSection,\n activeTestpart: augmentedTestPart,\n test: activeTest\n };\n }\n\n render() {\n // if (!this.stampContext) return nothing;\n return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}\n ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-stamp': TestStamp;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,YAAY,eAAe;AAC1C,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,uBAAuB;AAChC,SAAS,eAAe;AAgBjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAML,SAAO,QAAQ;AAOf,SAAQ,eAMJ;AAAA,MACF,MAAM;AAAA,MACN,YAAY,CAAC;AAAA,MACb,eAAe;AAAA,QACb,OAAO,CAAC;AAAA,MACV;AAAA,MACA,gBAAgB;AAAA,QACd,OAAO,CAAC;AAAA,MACV;AAAA,MACA,MAAM,CAAC;AAAA,IACT;AAAA;AAAA,EAIU,mBAAmD;AAC3D,WAAO;AAAA,EACT;AAAA,EAEA,oBAA0B;AACxB,UAAM,kBAAkB;AACxB,UAAM,kBAAkB,KAAK,cAAmC,UAAU;AAC1E,QAAI,CAAC,iBAAiB;AACpB,WAAK,aAAa;AAClB;AAAA,IACF;AACA,SAAK,aAAa,gBAAgB,eAAe;AAAA,EACnD;AAAA,EAEU,WAAW,oBAA0C;AAC7D,QAAI,CAAC,KAAK,iBAAiB;AACzB,WAAK,eAAe;AACpB;AAAA,IACF;AACA,UAAM,iBAAiB,KAAK,gBAAgB,UAAU,KAAK,cAAY,SAAS,MAAM;AACtF,UAAM,gBAAg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,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
+ return;
44
+ }
45
+ const activeTestPart = this.computedContext.testParts.find((testPart) => testPart.active);
46
+ const activeSection = activeTestPart?.sections.find((section) => section.active);
47
+ const activeItem = activeSection?.items.find((item) => item.active);
48
+ const { variables, ...augmentedItem } = activeItem || {};
49
+ const augmentedTestPart = {
50
+ ...activeTestPart,
51
+ items: activeTestPart.sections.flatMap((section) => section.items.map(({ variables: variables2, ...rest }) => rest)),
52
+ sections: activeTestPart.sections.map((section) => ({
53
+ ...section,
54
+ items: section.items.map(({ variables: variables2, ...rest }) => rest)
55
+ }))
56
+ };
57
+ console.log("activeTestPart", activeTestPart);
58
+ const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables: variables2, ...rest }) => rest) };
59
+ const { testParts, ...activeTest } = this.computedContext;
60
+ this.stampContext = {
61
+ view: this.computedContext.view,
62
+ activeItem: augmentedItem,
63
+ activeSection: augmentedSection,
64
+ activeTestpart: augmentedTestPart,
65
+ test: activeTest
66
+ };
67
+ }
68
+ render() {
69
+ return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
70
+ ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
71
+ }
72
+ };
73
+ __decorateClass([
74
+ property({ type: Boolean, reflect: true })
75
+ ], TestStamp.prototype, "debug", 2);
76
+ __decorateClass([
77
+ state(),
78
+ consume({ context: computedContext, subscribe: true })
79
+ ], TestStamp.prototype, "computedContext", 2);
80
+ __decorateClass([
81
+ state()
82
+ ], TestStamp.prototype, "stampContext", 2);
83
+ TestStamp = __decorateClass([
84
+ customElement("test-stamp")
85
+ ], TestStamp);
86
+
87
+ export {
88
+ TestStamp
89
+ };
90
+ //# sourceMappingURL=chunk-H2HBYOZZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-stamp.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { prepareTemplate } from 'stampino';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { View } from '../core/mixins/test-view.mixin';\nimport type { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n/**\n * A custom web component that renders a test stamp using the Lit framework.\n * This component is deprecated and will be removed in the future.\n * @customElement\n * @extends {LitElement}\n */\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\n /**\n * Indicates whether the component is in debug mode.\n * When set to `true`, the available objects and properties (i.e.: stampContext) is displayed.\n */\n @property({ type: Boolean, reflect: true })\n public debug = false;\n\n @state()\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n @state()\n private stampContext: {\n view?: View;\n test?: unknown;\n activeTestpart?: unknown;\n activeSection?: unknown;\n activeItem?: unknown;\n } = {\n view: 'candidate',\n activeItem: {},\n activeSection: {\n items: []\n },\n activeTestpart: {\n items: []\n },\n test: {}\n };\n\n myTemplate: TemplateFunction;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n const templateElement = this.querySelector<HTMLTemplateElement>('template');\n if (!templateElement) {\n this.myTemplate = null;\n return;\n }\n this.myTemplate = prepareTemplate(templateElement);\n }\n\n protected willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) {\n return;\n }\n const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);\n const activeSection = activeTestPart?.sections.find(section => section.active);\n const activeItem = activeSection?.items.find(item => item.active);\n const { variables, ...augmentedItem } = activeItem || {};\n\n const augmentedTestPart = {\n ...activeTestPart,\n items: activeTestPart.sections.flatMap(section => section.items.map(({ variables, ...rest }) => rest)),\n sections: activeTestPart.sections.map(section => ({\n ...section,\n items: section.items.map(({ variables, ...rest }) => rest)\n }))\n };\n\n console.log('activeTestPart', activeTestPart);\n\n const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables, ...rest }) => rest) };\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n view: this.computedContext.view,\n activeItem: augmentedItem,\n activeSection: augmentedSection,\n activeTestpart: augmentedTestPart,\n test: activeTest\n };\n }\n\n render() {\n // if (!this.stampContext) return nothing;\n return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}\n ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-stamp': TestStamp;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,YAAY,eAAe;AAC1C,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,uBAAuB;AAChC,SAAS,eAAe;AAgBjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAML,SAAO,QA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AAE;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;AA9ES;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,87 @@
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
+ const activeTestPart = this.computedContext.testParts.find((testPart) => testPart.active);
43
+ const activeSection = activeTestPart?.sections.find((section) => section.active);
44
+ const activeItem = activeSection?.items.find((item) => item.active);
45
+ const { variables, ...augmentedItem } = activeItem || {};
46
+ const augmentedTestPart = {
47
+ ...activeTestPart,
48
+ items: activeTestPart.sections.flatMap((section) => section.items.map(({ variables: variables2, ...rest }) => rest)),
49
+ sections: activeTestPart.sections.map((section) => ({
50
+ ...section,
51
+ items: section.items.map(({ variables: variables2, ...rest }) => rest)
52
+ }))
53
+ };
54
+ console.log("activeTestPart", activeTestPart);
55
+ const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables: variables2, ...rest }) => rest) };
56
+ const { testParts, ...activeTest } = this.computedContext;
57
+ this.stampContext = {
58
+ view: this.computedContext.view,
59
+ activeItem: augmentedItem,
60
+ activeSection: augmentedSection,
61
+ activeTestpart: augmentedTestPart,
62
+ test: activeTest
63
+ };
64
+ }
65
+ render() {
66
+ return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
67
+ ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
68
+ }
69
+ };
70
+ __decorateClass([
71
+ property({ type: Boolean, reflect: true })
72
+ ], TestStamp.prototype, "debug", 2);
73
+ __decorateClass([
74
+ state(),
75
+ consume({ context: computedContext, subscribe: true })
76
+ ], TestStamp.prototype, "computedContext", 2);
77
+ __decorateClass([
78
+ state()
79
+ ], TestStamp.prototype, "stampContext", 2);
80
+ TestStamp = __decorateClass([
81
+ customElement("test-stamp")
82
+ ], TestStamp);
83
+
84
+ export {
85
+ TestStamp
86
+ };
87
+ //# sourceMappingURL=chunk-H6RDLSTK.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 console.log('activeTestPart', activeTestPart);\n\n const augmentedSection = { ...activeSection, items: activeSection.items.map(({ variables, ...rest }) => rest) };\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n view: this.computedContext.view,\n activeItem: augmentedItem,\n activeSection: augmentedSection,\n activeTestpart: augmentedTestPart,\n test: activeTest\n };\n }\n\n render() {\n // if (!this.stampContext) return nothing;\n return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}\n ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-stamp': TestStamp;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,YAAY,eAAe;AAC1C,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,uBAAuB;AAChC,SAAS,eAAe;AAgBjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAML,SAAO,QAAQ;AAOf,SAAQ,eAMJ;AAAA,MACF,MAAM;AAAA,MACN,YAAY,CAAC;AAAA,MACb,eAAe;AAAA,QACb,OAAO,CAAC;AAAA,MACV;AAAA,MACA,gBAAgB;AAAA,QACd,OAAO,CAAC;AAAA,MACV;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;AAK7D,UAAM,iBAAiB,KAAK,gBAAgB,UAAU,KAAK,cAAY,SAAS,MAAM;AACtF,UAAM,gBAAgB,gBAAg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