@qti-components/test 2.0.0-next.4 → 2.0.0-next.6

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 (46) hide show
  1. package/dist/components/index.d.ts +0 -11
  2. package/dist/components/index.js +0 -11
  3. package/dist/components/index.js.map +1 -1
  4. package/dist/components/test-bookmark/test-bookmark.d.ts +48 -0
  5. package/dist/components/test-bookmark/test-bookmark.js +144 -0
  6. package/dist/components/test-bookmark/test-bookmark.js.map +1 -0
  7. package/dist/components/test-navigation/test-navigation.js +8 -2
  8. package/dist/components/test-navigation/test-navigation.js.map +1 -1
  9. package/dist/components/test-stamp/test-stamp.js +6 -2
  10. package/dist/components/test-stamp/test-stamp.js.map +1 -1
  11. package/dist/elements.d.ts +31 -44
  12. package/dist/elements.js +4 -30
  13. package/dist/elements.js.map +1 -1
  14. package/dist/index.d.ts +2 -0
  15. package/dist/index.js +2 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/mixins/test-state.mixin.js +25 -1
  18. package/dist/mixins/test-state.mixin.js.map +1 -1
  19. package/dist/plugin-state.d.ts +8 -0
  20. package/dist/plugin-state.js +7 -0
  21. package/dist/plugin-state.js.map +1 -0
  22. package/dist/plugins/elements.d.ts +71 -0
  23. package/dist/plugins/elements.js +33 -0
  24. package/dist/plugins/elements.js.map +1 -0
  25. package/dist/plugins/index.d.ts +2 -0
  26. package/dist/plugins/index.js +3 -0
  27. package/dist/plugins/index.js.map +1 -0
  28. package/dist/public-events.d.ts +5 -0
  29. package/dist/public-events.js +1 -0
  30. package/dist/public-events.js.map +1 -1
  31. package/dist/tts/elements.d.ts +28 -0
  32. package/dist/tts/elements.js +14 -0
  33. package/dist/tts/elements.js.map +1 -0
  34. package/dist/{components/test-item-to-speech → tts}/test-item-to-speech.d.ts +9 -9
  35. package/dist/{components/test-item-to-speech → tts}/test-item-to-speech.js +59 -85
  36. package/dist/tts/test-item-to-speech.js.map +1 -0
  37. package/dist/types/qti-test-state.d.ts +12 -1
  38. package/dist/types/qti-test-state.js.map +1 -1
  39. package/package.json +11 -7
  40. package/dist/components/test-item-to-speech/test-item-to-speech.js.map +0 -1
  41. package/dist/components/test-paging-buttons-stamp/test-paging-buttons-stamp.d.ts +0 -19
  42. package/dist/components/test-paging-buttons-stamp/test-paging-buttons-stamp.js +0 -39
  43. package/dist/components/test-paging-buttons-stamp/test-paging-buttons-stamp.js.map +0 -1
  44. package/dist/components/test-section-buttons-stamp/test-section-buttons-stamp.d.ts +0 -19
  45. package/dist/components/test-section-buttons-stamp/test-section-buttons-stamp.js +0 -39
  46. package/dist/components/test-section-buttons-stamp/test-section-buttons-stamp.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"test-stamp.js","sourceRoot":"","sources":["../../../src/components/test-stamp/test-stamp.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAOvD;;;;;GAKG;AAEH,MAAM,OAAO,SAAU,SAAQ,UAAU;IAAzC;;QACE;;;WAGG;QAEI,UAAK,GAAG,KAAK,CAAC;QAOb,iBAAY,GAMhB;YACF,IAAI,EAAE,WAAW;YACjB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE;gBACb,KAAK,EAAE,EAAE;aACV;YACD,cAAc,EAAE;gBACd,KAAK,EAAE,EAAE;gBACT,QAAQ,EAAE,EAAE;aACb;YACD,IAAI,EAAE,EAAE;SACT,CAAC;IA+DJ,CAAC;IA3DoB,gBAAgB;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAEQ,iBAAiB;QACxB,KAAK,C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tB;AAIb;IAFP,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;kDACd;AAGjC;IADP,KAAK,EAAE;+CAkBN","sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { prepareTemplate } from '@heximal/templates';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '@qti-components/base';\n\nimport type { View } from '@qti-components/base';\nimport type { PropertyValues } from 'lit';\nimport type { ComputedContext } from '@qti-components/base';\nimport type { TemplateFunction } from '@heximal/templates';\n\n/**\n * A custom web component that renders a test stamp using the Lit framework.\n * This component is deprecated and will be removed in the future.\n * @customElement\n * @extends {LitElement}\n */\n\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 override createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n override 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 override 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 this.dispatchEvent(\n new CustomEvent('qti-stamp-context-updated', {\n detail: this.stampContext,\n bubbles: true\n })\n );\n }\n\n override 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"]}
1
+ {"version":3,"file":"test-stamp.js","sourceRoot":"","sources":["../../../src/components/test-stamp/test-stamp.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAOvD;;;;;GAKG;AAEH,MAAM,OAAO,SAAU,SAAQ,UAAU;IAAzC;;QACE;;;WAGG;QAEI,UAAK,GAAG,KAAK,CAAC;QAOb,iBAAY,GAMhB;YACF,IAAI,EAAE,WAAW;YACjB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE;gBACb,KAAK,EAAE,EAAE;a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C,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACrE,CAAC;CACF;AA3FQ;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCACtB;AAIb;IAFP,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;kDACd;AAGjC;IADP,KAAK,EAAE;+CAkBN","sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { prepareTemplate } from '@heximal/templates';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '@qti-components/base';\n\nimport type { View } from '@qti-components/base';\nimport type { PropertyValues } from 'lit';\nimport type { ComputedContext } from '@qti-components/base';\nimport type { TemplateFunction } from '@heximal/templates';\n\n/**\n * A custom web component that renders a test stamp using the Lit framework.\n * This component is deprecated and will be removed in the future.\n * @customElement\n * @extends {LitElement}\n */\n\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 override createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n override 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 override 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 // In `navigate=\"section\"` the test shows a section, not one item, so there may be no active item.\n const { variables, ...augmentedItem } = activeItem || {};\n\n if (!activeTestPart) {\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 = {\n ...activeSection,\n items: (activeSection?.items ?? []).map(({ variables, ...rest }) => rest)\n };\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 this.dispatchEvent(\n new CustomEvent('qti-stamp-context-updated', {\n detail: this.stampContext,\n bubbles: true\n })\n );\n }\n\n override 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"]}
@@ -11,25 +11,15 @@ import { QtiTestFeedback } from './components/qti-test-feedback/qti-test-feedbac
11
11
  import { QtiTestPart } from './components/qti-test-part/qti-test-part';
12
12
  import { QtiTestVariables } from './components/qti-test-variables/qti-test-variables';
13
13
  import { QtiTest } from './components/qti-test/qti-test';
14
- import { TestCheckItem } from './components/test-check-item/test-check-item';
15
14
  import { TestContainer } from './components/test-container/test-container';
16
15
  import { TestEndAttempt } from './components/test-end-attempt/test-end-attempt';
17
16
  import { TestItemLink } from './components/test-item-link/test-item-link';
18
- import { TestItemToSpeech, TestTtsNext, TestTtsPause, TestTtsPick, TestTtsPlay, TestTtsPrev, TestTtsResume, TestTtsStop } from './components/test-item-to-speech/test-item-to-speech';
19
17
  import { TestNavigation } from './components/test-navigation/test-navigation';
20
18
  import { TestNext } from './components/test-next/test-next';
21
- import { TestPagingButtonsStamp } from './components/test-paging-buttons-stamp/test-paging-buttons-stamp';
22
19
  import { TestPrev } from './components/test-prev/test-prev';
23
- import { TestPrintContext } from './components/test-print-context/test-print-context';
24
- import { TestPrintVariables } from './components/test-print-item-variables/test-print-item-variables';
25
- import { TestScoringButtons } from './components/test-scoring-buttons/test-scoring-buttons';
26
- import { TestScoringFeedback } from './components/test-scoring-feedback/test-scoring-feedback';
27
- import { TestSectionButtonsStamp } from './components/test-section-buttons-stamp/test-section-buttons-stamp';
28
20
  import { TestSectionLink } from './components/test-section-link/test-section-link';
29
- import { TestStamp } from './components/test-stamp/test-stamp';
30
- import { TestView } from './components/test-view-toggle/test-view';
31
- import { TestViewToggle } from './components/test-view-toggle/test-view-toggle';
32
- export { QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiBranchRule, QtiItemSessionControl, QtiNumberPresented, QtiNumberSelected, QtiOutcomeProcessing, QtiPreCondition, QtiTest, QtiTestFeedback, QtiTestPart, QtiTestVariables, TestCheckItem, TestContainer, TestEndAttempt, TestItemLink, TestItemToSpeech, TestNavigation, TestNext, TestPagingButtonsStamp, TestPrev, TestPrintContext, TestPrintVariables, TestScoringButtons, TestScoringFeedback, TestSectionButtonsStamp, TestSectionLink, TestStamp, TestTtsNext, TestTtsPause, TestTtsPick, TestTtsPlay, TestTtsPrev, TestTtsResume, TestTtsStop, TestView, TestViewToggle };
21
+ export * from './plugins/elements';
22
+ export { QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiBranchRule, QtiItemSessionControl, QtiNumberPresented, QtiNumberSelected, QtiOutcomeProcessing, QtiPreCondition, QtiTest, QtiTestFeedback, QtiTestPart, QtiTestVariables, TestContainer, TestEndAttempt, TestItemLink, TestNavigation, TestNext, TestPrev, TestSectionLink };
33
23
  export declare const qtiTestElements: readonly [{
34
24
  readonly tag: "qti-assessment-item-ref";
35
25
  readonly ctor: typeof QtiAssessmentItemRef;
@@ -69,9 +59,6 @@ export declare const qtiTestElements: readonly [{
69
59
  }, {
70
60
  readonly tag: "qti-test-variables";
71
61
  readonly ctor: typeof QtiTestVariables;
72
- }, {
73
- readonly tag: "test-check-item";
74
- readonly ctor: typeof TestCheckItem;
75
62
  }, {
76
63
  readonly tag: "test-container";
77
64
  readonly ctor: typeof TestContainer;
@@ -81,67 +68,67 @@ export declare const qtiTestElements: readonly [{
81
68
  }, {
82
69
  readonly tag: "test-item-link";
83
70
  readonly ctor: typeof TestItemLink;
84
- }, {
85
- readonly tag: "test-item-to-speech";
86
- readonly ctor: typeof TestItemToSpeech;
87
71
  }, {
88
72
  readonly tag: "test-navigation";
89
73
  readonly ctor: typeof TestNavigation;
90
74
  }, {
91
75
  readonly tag: "test-next";
92
76
  readonly ctor: typeof TestNext;
93
- }, {
94
- readonly tag: "test-paging-buttons-stamp";
95
- readonly ctor: typeof TestPagingButtonsStamp;
96
77
  }, {
97
78
  readonly tag: "test-prev";
98
79
  readonly ctor: typeof TestPrev;
80
+ }, {
81
+ readonly tag: "test-section-link";
82
+ readonly ctor: typeof TestSectionLink;
83
+ }, {
84
+ readonly tag: "test-check-item";
85
+ readonly ctor: typeof import("./elements").TestCheckItem;
86
+ }, {
87
+ readonly tag: "test-bookmark";
88
+ readonly ctor: typeof import("./elements").TestBookmark;
99
89
  }, {
100
90
  readonly tag: "test-print-context";
101
- readonly ctor: typeof TestPrintContext;
91
+ readonly ctor: typeof import("./elements").TestPrintContext;
102
92
  }, {
103
93
  readonly tag: "test-print-item-variables";
104
- readonly ctor: typeof TestPrintVariables;
94
+ readonly ctor: typeof import("./elements").TestPrintVariables;
105
95
  }, {
106
96
  readonly tag: "test-scoring-buttons";
107
- readonly ctor: typeof TestScoringButtons;
97
+ readonly ctor: typeof import("./elements").TestScoringButtons;
108
98
  }, {
109
99
  readonly tag: "test-scoring-feedback";
110
- readonly ctor: typeof TestScoringFeedback;
100
+ readonly ctor: typeof import("./elements").TestScoringFeedback;
111
101
  }, {
112
- readonly tag: "test-section-buttons-stamp";
113
- readonly ctor: typeof TestSectionButtonsStamp;
102
+ readonly tag: "test-stamp";
103
+ readonly ctor: typeof import("./elements").TestStamp;
114
104
  }, {
115
- readonly tag: "test-section-link";
116
- readonly ctor: typeof TestSectionLink;
105
+ readonly tag: "test-view";
106
+ readonly ctor: typeof import("./elements").TestView;
117
107
  }, {
118
- readonly tag: "test-stamp";
119
- readonly ctor: typeof TestStamp;
108
+ readonly tag: "test-view-toggle";
109
+ readonly ctor: typeof import("./elements").TestViewToggle;
110
+ }, {
111
+ readonly tag: "test-item-to-speech";
112
+ readonly ctor: typeof import("./elements").TestItemToSpeech;
120
113
  }, {
121
114
  readonly tag: "test-tts-next";
122
- readonly ctor: typeof TestTtsNext;
115
+ readonly ctor: typeof import("./elements").TestTtsNext;
123
116
  }, {
124
117
  readonly tag: "test-tts-pause";
125
- readonly ctor: typeof TestTtsPause;
118
+ readonly ctor: typeof import("./elements").TestTtsPause;
126
119
  }, {
127
120
  readonly tag: "test-tts-pick";
128
- readonly ctor: typeof TestTtsPick;
121
+ readonly ctor: typeof import("./elements").TestTtsPick;
129
122
  }, {
130
123
  readonly tag: "test-tts-play";
131
- readonly ctor: typeof TestTtsPlay;
124
+ readonly ctor: typeof import("./elements").TestTtsPlay;
132
125
  }, {
133
126
  readonly tag: "test-tts-prev";
134
- readonly ctor: typeof TestTtsPrev;
127
+ readonly ctor: typeof import("./elements").TestTtsPrev;
135
128
  }, {
136
129
  readonly tag: "test-tts-resume";
137
- readonly ctor: typeof TestTtsResume;
130
+ readonly ctor: typeof import("./elements").TestTtsResume;
138
131
  }, {
139
132
  readonly tag: "test-tts-stop";
140
- readonly ctor: typeof TestTtsStop;
141
- }, {
142
- readonly tag: "test-view";
143
- readonly ctor: typeof TestView;
144
- }, {
145
- readonly tag: "test-view-toggle";
146
- readonly ctor: typeof TestViewToggle;
133
+ readonly ctor: typeof import("./elements").TestTtsStop;
147
134
  }];
package/dist/elements.js CHANGED
@@ -11,25 +11,16 @@ import { QtiTestFeedback } from './components/qti-test-feedback/qti-test-feedbac
11
11
  import { QtiTestPart } from './components/qti-test-part/qti-test-part';
12
12
  import { QtiTestVariables } from './components/qti-test-variables/qti-test-variables';
13
13
  import { QtiTest } from './components/qti-test/qti-test';
14
- import { TestCheckItem } from './components/test-check-item/test-check-item';
15
14
  import { TestContainer } from './components/test-container/test-container';
16
15
  import { TestEndAttempt } from './components/test-end-attempt/test-end-attempt';
17
16
  import { TestItemLink } from './components/test-item-link/test-item-link';
18
- import { TestItemToSpeech, TestTtsNext, TestTtsPause, TestTtsPick, TestTtsPlay, TestTtsPrev, TestTtsResume, TestTtsStop } from './components/test-item-to-speech/test-item-to-speech';
19
17
  import { TestNavigation } from './components/test-navigation/test-navigation';
20
18
  import { TestNext } from './components/test-next/test-next';
21
- import { TestPagingButtonsStamp } from './components/test-paging-buttons-stamp/test-paging-buttons-stamp';
22
19
  import { TestPrev } from './components/test-prev/test-prev';
23
- import { TestPrintContext } from './components/test-print-context/test-print-context';
24
- import { TestPrintVariables } from './components/test-print-item-variables/test-print-item-variables';
25
- import { TestScoringButtons } from './components/test-scoring-buttons/test-scoring-buttons';
26
- import { TestScoringFeedback } from './components/test-scoring-feedback/test-scoring-feedback';
27
- import { TestSectionButtonsStamp } from './components/test-section-buttons-stamp/test-section-buttons-stamp';
28
20
  import { TestSectionLink } from './components/test-section-link/test-section-link';
29
- import { TestStamp } from './components/test-stamp/test-stamp';
30
- import { TestView } from './components/test-view-toggle/test-view';
31
- import { TestViewToggle } from './components/test-view-toggle/test-view-toggle';
32
- export { QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiBranchRule, QtiItemSessionControl, QtiNumberPresented, QtiNumberSelected, QtiOutcomeProcessing, QtiPreCondition, QtiTest, QtiTestFeedback, QtiTestPart, QtiTestVariables, TestCheckItem, TestContainer, TestEndAttempt, TestItemLink, TestItemToSpeech, TestNavigation, TestNext, TestPagingButtonsStamp, TestPrev, TestPrintContext, TestPrintVariables, TestScoringButtons, TestScoringFeedback, TestSectionButtonsStamp, TestSectionLink, TestStamp, TestTtsNext, TestTtsPause, TestTtsPick, TestTtsPlay, TestTtsPrev, TestTtsResume, TestTtsStop, TestView, TestViewToggle };
21
+ import { pluginElements } from './plugins/elements';
22
+ export * from './plugins/elements';
23
+ export { QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiBranchRule, QtiItemSessionControl, QtiNumberPresented, QtiNumberSelected, QtiOutcomeProcessing, QtiPreCondition, QtiTest, QtiTestFeedback, QtiTestPart, QtiTestVariables, TestContainer, TestEndAttempt, TestItemLink, TestNavigation, TestNext, TestPrev, TestSectionLink };
33
24
  export const qtiTestElements = [
34
25
  { tag: 'qti-assessment-item-ref', ctor: QtiAssessmentItemRef },
35
26
  { tag: 'qti-assessment-section', ctor: QtiAssessmentSection },
@@ -44,30 +35,13 @@ export const qtiTestElements = [
44
35
  { tag: 'qti-test-feedback', ctor: QtiTestFeedback },
45
36
  { tag: 'qti-test-part', ctor: QtiTestPart },
46
37
  { tag: 'qti-test-variables', ctor: QtiTestVariables },
47
- { tag: 'test-check-item', ctor: TestCheckItem },
48
38
  { tag: 'test-container', ctor: TestContainer },
49
39
  { tag: 'test-end-attempt', ctor: TestEndAttempt },
50
40
  { tag: 'test-item-link', ctor: TestItemLink },
51
- { tag: 'test-item-to-speech', ctor: TestItemToSpeech },
52
41
  { tag: 'test-navigation', ctor: TestNavigation },
53
42
  { tag: 'test-next', ctor: TestNext },
54
- { tag: 'test-paging-buttons-stamp', ctor: TestPagingButtonsStamp },
55
43
  { tag: 'test-prev', ctor: TestPrev },
56
- { tag: 'test-print-context', ctor: TestPrintContext },
57
- { tag: 'test-print-item-variables', ctor: TestPrintVariables },
58
- { tag: 'test-scoring-buttons', ctor: TestScoringButtons },
59
- { tag: 'test-scoring-feedback', ctor: TestScoringFeedback },
60
- { tag: 'test-section-buttons-stamp', ctor: TestSectionButtonsStamp },
61
44
  { tag: 'test-section-link', ctor: TestSectionLink },
62
- { tag: 'test-stamp', ctor: TestStamp },
63
- { tag: 'test-tts-next', ctor: TestTtsNext },
64
- { tag: 'test-tts-pause', ctor: TestTtsPause },
65
- { tag: 'test-tts-pick', ctor: TestTtsPick },
66
- { tag: 'test-tts-play', ctor: TestTtsPlay },
67
- { tag: 'test-tts-prev', ctor: TestTtsPrev },
68
- { tag: 'test-tts-resume', ctor: TestTtsResume },
69
- { tag: 'test-tts-stop', ctor: TestTtsStop },
70
- { tag: 'test-view', ctor: TestView },
71
- { tag: 'test-view-toggle', ctor: TestViewToggle }
45
+ ...pluginElements
72
46
  ];
73
47
  //# sourceMappingURL=elements.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"elements.js","sourceRoot":"","sources":["../src/elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gEAAgE,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EA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AAG,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3C,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3C,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,aAAa,EAAE;IAC/C,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3C,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;IACpC,EAAE,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,EAAE;CACzC,CAAC","sourcesContent":["import { QtiAssessmentItemRef } from './components/qti-assessment-item-ref/qti-assessment-item-ref';\nimport { QtiAssessmentSection } from './components/qti-assessment-section/qti-assessment-section';\nimport { QtiAssessmentTest } from './components/qti-assessment-test/qti-assessment-test';\nimport { QtiBranchRule } from './components/qti-branch-rule/qti-branch-rule';\nimport { QtiItemSessionControl } from './components/qti-item-session-control/qti-item-session-control';\nimport { QtiNumberPresented } from './components/qti-number-presented/qti-number-presented';\nimport { QtiNumberSelected } from './components/qti-number-selected/qti-number-selected';\nimport { QtiPreCondition } from './components/qti-pre-condition/qti-pre-condition';\nimport { QtiOutcomeProcessing } from './components/qti-outcome-processing/qti-outcome-processing';\nimport { QtiTestFeedback } from './components/qti-test-feedback/qti-test-feedback';\nimport { QtiTestPart } from './components/qti-test-part/qti-test-part';\nimport { QtiTestVariables } from './components/qti-test-variables/qti-test-variables';\nimport { QtiTest } from './components/qti-test/qti-test';\nimport { TestCheckItem } from './components/test-check-item/test-check-item';\nimport { TestContainer } from './components/test-container/test-container';\nimport { TestEndAttempt } from './components/test-end-attempt/test-end-attempt';\nimport { TestItemLink } from './components/test-item-link/test-item-link';\nimport {\n TestItemToSpeech,\n TestTtsNext,\n TestTtsPause,\n TestTtsPick,\n TestTtsPlay,\n TestTtsPrev,\n TestTtsResume,\n TestTtsStop\n} from './components/test-item-to-speech/test-item-to-speech';\nimport { TestNavigation } from './components/test-navigation/test-navigation';\nimport { TestNext } from './components/test-next/test-next';\nimport { TestPagingButtonsStamp } from './components/test-paging-buttons-stamp/test-paging-buttons-stamp';\nimport { TestPrev } from './components/test-prev/test-prev';\nimport { TestPrintContext } from './components/test-print-context/test-print-context';\nimport { TestPrintVariables } from './components/test-print-item-variables/test-print-item-variables';\nimport { TestScoringButtons } from './components/test-scoring-buttons/test-scoring-buttons';\nimport { TestScoringFeedback } from './components/test-scoring-feedback/test-scoring-feedback';\nimport { TestSectionButtonsStamp } from './components/test-section-buttons-stamp/test-section-buttons-stamp';\nimport { TestSectionLink } from './components/test-section-link/test-section-link';\nimport { TestStamp } from './components/test-stamp/test-stamp';\nimport { TestView } from './components/test-view-toggle/test-view';\nimport { TestViewToggle } from './components/test-view-toggle/test-view-toggle';\n\nexport {\n QtiAssessmentItemRef,\n QtiAssessmentSection,\n QtiAssessmentTest,\n QtiBranchRule,\n QtiItemSessionControl,\n QtiNumberPresented,\n QtiNumberSelected,\n QtiOutcomeProcessing,\n QtiPreCondition,\n QtiTest,\n QtiTestFeedback,\n QtiTestPart,\n QtiTestVariables,\n TestCheckItem,\n TestContainer,\n TestEndAttempt,\n TestItemLink,\n TestItemToSpeech,\n TestNavigation,\n TestNext,\n TestPagingButtonsStamp,\n TestPrev,\n TestPrintContext,\n TestPrintVariables,\n TestScoringButtons,\n TestScoringFeedback,\n TestSectionButtonsStamp,\n TestSectionLink,\n TestStamp,\n TestTtsNext,\n TestTtsPause,\n TestTtsPick,\n TestTtsPlay,\n TestTtsPrev,\n TestTtsResume,\n TestTtsStop,\n TestView,\n TestViewToggle\n};\n\nexport const qtiTestElements = [\n { tag: 'qti-assessment-item-ref', ctor: QtiAssessmentItemRef },\n { tag: 'qti-assessment-section', ctor: QtiAssessmentSection },\n { tag: 'qti-assessment-test', ctor: QtiAssessmentTest },\n { tag: 'qti-branch-rule', ctor: QtiBranchRule },\n { tag: 'qti-item-session-control', ctor: QtiItemSessionControl },\n { tag: 'qti-number-presented', ctor: QtiNumberPresented },\n { tag: 'qti-number-selected', ctor: QtiNumberSelected },\n { tag: 'qti-outcome-processing', ctor: QtiOutcomeProcessing },\n { tag: 'qti-pre-condition', ctor: QtiPreCondition },\n { tag: 'qti-test', ctor: QtiTest },\n { tag: 'qti-test-feedback', ctor: QtiTestFeedback },\n { tag: 'qti-test-part', ctor: QtiTestPart },\n { tag: 'qti-test-variables', ctor: QtiTestVariables },\n { tag: 'test-check-item', ctor: TestCheckItem },\n { tag: 'test-container', ctor: TestContainer },\n { tag: 'test-end-attempt', ctor: TestEndAttempt },\n { tag: 'test-item-link', ctor: TestItemLink },\n { tag: 'test-item-to-speech', ctor: TestItemToSpeech },\n { tag: 'test-navigation', ctor: TestNavigation },\n { tag: 'test-next', ctor: TestNext },\n { tag: 'test-paging-buttons-stamp', ctor: TestPagingButtonsStamp },\n { tag: 'test-prev', ctor: TestPrev },\n { tag: 'test-print-context', ctor: TestPrintContext },\n { tag: 'test-print-item-variables', ctor: TestPrintVariables },\n { tag: 'test-scoring-buttons', ctor: TestScoringButtons },\n { tag: 'test-scoring-feedback', ctor: TestScoringFeedback },\n { tag: 'test-section-buttons-stamp', ctor: TestSectionButtonsStamp },\n { tag: 'test-section-link', ctor: TestSectionLink },\n { tag: 'test-stamp', ctor: TestStamp },\n { tag: 'test-tts-next', ctor: TestTtsNext },\n { tag: 'test-tts-pause', ctor: TestTtsPause },\n { tag: 'test-tts-pick', ctor: TestTtsPick },\n { tag: 'test-tts-play', ctor: TestTtsPlay },\n { tag: 'test-tts-prev', ctor: TestTtsPrev },\n { tag: 'test-tts-resume', ctor: TestTtsResume },\n { tag: 'test-tts-stop', ctor: TestTtsStop },\n { tag: 'test-view', ctor: TestView },\n { tag: 'test-view-toggle', ctor: TestViewToggle }\n] as const;\n"]}
1
+ {"version":3,"file":"elements.js","sourceRoot":"","sources":["../src/elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAC;AACpG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,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;IACpC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;IACpC,EAAE,GAAG,EAAE,mBAAmB,EAAE,IAAI,EAAE,eAAe,EAAE;IACnD,GAAG,cAAc;CACT,CAAC","sourcesContent":["import { QtiAssessmentItemRef } from './components/qti-assessment-item-ref/qti-assessment-item-ref';\nimport { QtiAssessmentSection } from './components/qti-assessment-section/qti-assessment-section';\nimport { QtiAssessmentTest } from './components/qti-assessment-test/qti-assessment-test';\nimport { QtiBranchRule } from './components/qti-branch-rule/qti-branch-rule';\nimport { QtiItemSessionControl } from './components/qti-item-session-control/qti-item-session-control';\nimport { QtiNumberPresented } from './components/qti-number-presented/qti-number-presented';\nimport { QtiNumberSelected } from './components/qti-number-selected/qti-number-selected';\nimport { QtiPreCondition } from './components/qti-pre-condition/qti-pre-condition';\nimport { QtiOutcomeProcessing } from './components/qti-outcome-processing/qti-outcome-processing';\nimport { QtiTestFeedback } from './components/qti-test-feedback/qti-test-feedback';\nimport { QtiTestPart } from './components/qti-test-part/qti-test-part';\nimport { QtiTestVariables } from './components/qti-test-variables/qti-test-variables';\nimport { QtiTest } from './components/qti-test/qti-test';\nimport { TestContainer } from './components/test-container/test-container';\nimport { TestEndAttempt } from './components/test-end-attempt/test-end-attempt';\nimport { TestItemLink } from './components/test-item-link/test-item-link';\nimport { TestNavigation } from './components/test-navigation/test-navigation';\nimport { TestNext } from './components/test-next/test-next';\nimport { TestPrev } from './components/test-prev/test-prev';\nimport { TestSectionLink } from './components/test-section-link/test-section-link';\nimport { pluginElements } from './plugins/elements';\n\nexport * from './plugins/elements';\n\nexport {\n QtiAssessmentItemRef,\n QtiAssessmentSection,\n QtiAssessmentTest,\n QtiBranchRule,\n QtiItemSessionControl,\n QtiNumberPresented,\n QtiNumberSelected,\n QtiOutcomeProcessing,\n QtiPreCondition,\n QtiTest,\n QtiTestFeedback,\n QtiTestPart,\n QtiTestVariables,\n TestContainer,\n TestEndAttempt,\n TestItemLink,\n TestNavigation,\n TestNext,\n TestPrev,\n TestSectionLink\n};\n\nexport const qtiTestElements = [\n { tag: 'qti-assessment-item-ref', ctor: QtiAssessmentItemRef },\n { tag: 'qti-assessment-section', ctor: QtiAssessmentSection },\n { tag: 'qti-assessment-test', ctor: QtiAssessmentTest },\n { tag: 'qti-branch-rule', ctor: QtiBranchRule },\n { tag: 'qti-item-session-control', ctor: QtiItemSessionControl },\n { tag: 'qti-number-presented', ctor: QtiNumberPresented },\n { tag: 'qti-number-selected', ctor: QtiNumberSelected },\n { tag: 'qti-outcome-processing', ctor: QtiOutcomeProcessing },\n { tag: 'qti-pre-condition', ctor: QtiPreCondition },\n { tag: 'qti-test', ctor: QtiTest },\n { tag: 'qti-test-feedback', ctor: QtiTestFeedback },\n { tag: 'qti-test-part', ctor: QtiTestPart },\n { tag: 'qti-test-variables', ctor: QtiTestVariables },\n { tag: 'test-container', ctor: TestContainer },\n { tag: 'test-end-attempt', ctor: TestEndAttempt },\n { tag: 'test-item-link', ctor: TestItemLink },\n { tag: 'test-navigation', ctor: TestNavigation },\n { tag: 'test-next', ctor: TestNext },\n { tag: 'test-prev', ctor: TestPrev },\n { tag: 'test-section-link', ctor: TestSectionLink },\n ...pluginElements\n] as const;\n"]}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import './register.js';
2
2
  export * from './components/index.js';
3
+ export * from './plugins/index.js';
4
+ export * from './plugin-state.js';
3
5
  export * from './types/iqti-test.js';
4
6
  export * from './types/qti-test-state.js';
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import './register.js';
2
2
  export * from './components/index.js';
3
+ export * from './plugins/index.js';
4
+ export * from './plugin-state.js';
3
5
  export * from './types/iqti-test.js';
4
6
  export * from './types/qti-test-state.js';
5
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC","sourcesContent":["import './register.js';\n\nexport * from './components/index.js';\nexport * from './types/iqti-test.js';\nexport * from './types/qti-test-state.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC","sourcesContent":["import './register.js';\n\nexport * from './components/index.js';\nexport * from './plugins/index.js';\nexport * from './plugin-state.js';\nexport * from './types/iqti-test.js';\nexport * from './types/qti-test-state.js';\n"]}
@@ -26,6 +26,7 @@ const toState = (test, session) => ({
26
26
  outcomes: (test?.testOutcomeVariables ?? []).map(v => ({ identifier: v.identifier, value: copy(v.value) }))
27
27
  },
28
28
  session: {
29
+ ...(session?.plugins && Object.keys(session.plugins).length > 0 ? { plugins: { ...session.plugins } } : {}),
29
30
  ...(session?.navPartId !== undefined ? { navPartId: session.navPartId } : {}),
30
31
  ...(session?.navSectionId !== undefined ? { navSectionId: session.navSectionId } : {}),
31
32
  ...(session?.navItemRefId !== undefined ? { navItemRefId: session.navItemRefId } : {})
@@ -56,6 +57,7 @@ export const TestStateMixin = (superClass) => {
56
57
  this.#ready = false;
57
58
  this.#lastEmitted = null;
58
59
  });
60
+ listenPublic(this, 'cito-test-update-plugin-state', ({ detail }) => this.#updatePluginState(detail));
59
61
  listenPublic(this, 'cito-test-loaded', () => {
60
62
  if (this.#pending) {
61
63
  this.#apply(this.#pending);
@@ -64,6 +66,23 @@ export const TestStateMixin = (superClass) => {
64
66
  this.#ready = true;
65
67
  });
66
68
  }
69
+ /** One plugin's entry, as JSON: the test stores it without reading it. `null` removes it. */
70
+ #updatePluginState({ plugin, value }) {
71
+ if (typeof plugin !== 'string' || plugin === '')
72
+ return;
73
+ const { [plugin]: _removed, ...others } = this.sessionContext.plugins ?? {};
74
+ let next = others;
75
+ if (value !== null && value !== undefined) {
76
+ try {
77
+ next = { ...others, [plugin]: JSON.parse(JSON.stringify(value)) };
78
+ }
79
+ catch {
80
+ console.warn(`[qti-test] Ignoring plugin state for "${plugin}": it is not JSON.`);
81
+ return;
82
+ }
83
+ }
84
+ this.sessionContext = { ...this.sessionContext, plugins: next };
85
+ }
67
86
  get state() {
68
87
  return toState(this.testContext, this.sessionContext);
69
88
  }
@@ -109,7 +128,12 @@ export const TestStateMixin = (superClass) => {
109
128
  };
110
129
  // Written before any navigation request, so the linear-mode restriction — which compares
111
130
  // against the current position — sees the restored item as current and lets it load.
112
- this.sessionContext = { ...this.sessionContext, ...this.#validSession(state.session) };
131
+ // Plugins are replaced, not merged: a state without them clears what an earlier one left.
132
+ this.sessionContext = {
133
+ ...this.sessionContext,
134
+ ...this.#validSession(state.session),
135
+ plugins: state.session.plugins && typeof state.session.plugins === 'object' ? { ...state.session.plugins } : {}
136
+ };
113
137
  }
114
138
  /** A stored position may point at an item or section a revised test no longer has. */
115
139
  #validSession(session) {
@@ -1 +1 @@
1
- {"version":3,"file":"test-state.mixin.js","sourceRoot":"","sources":["../../src/mixins/test-state.mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgChE,MAAM,IAAI,GAAG,CAAC,KAAkC,EAAS,EAAE,CACzD,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAE,KAAmC,IAAI,IAAI,CAAC,CAAC;AAErF,MAAM,cAAc,GAAG,CAAC,KAAc,EAAyB,EAAE;IA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-events';\n\nimport type { PropertyValues } from 'lit';\nimport type { SessionContext, TestContext } from '@qti-components/base';\nimport type { QtiTestState, QtiTestStateSession } from '../types/qti-test-state';\nimport type { TestBaseInterface } from './test-base';\n\ntype Constructor<T = {}> = abstract new (...args: any[]) => T;\ntype Value = string | string[] | null;\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'qti-state-changed': CustomEvent<QtiTestState>;\n }\n}\n\nexport interface ITestStateMixin {\n /**\n * The candidate's persistable state: what they answered and where they are.\n *\n * Assign a stored state to resume. It may be assigned at any time: before the test document\n * has loaded it is held and applied as soon as the test connects — before the first item\n * loads, so items and the initial navigation start from it — and after that it is applied\n * immediately and the test navigates to the restored position.\n *\n * Items are matched by item-ref identifier; items the state does not mention start fresh, and\n * stored items, test outcomes or a position the test no longer has are ignored. Restoring is a\n * resume, so linear-mode navigation restrictions do not apply.\n */\n state: QtiTestState;\n}\n\nconst copy = (value: Readonly<Value> | undefined): Value =>\n Array.isArray(value) ? [...value] : ((value as string | null | undefined) ?? null);\n\nconst isQtiTestState = (value: unknown): value is QtiTestState => {\n const state = value as QtiTestState | null;\n return (\n state?.version === QTI_TEST_STATE_VERSION &&\n Array.isArray(state.test?.items) &&\n Array.isArray(state.test?.outcomes) &&\n typeof state.session === 'object' &&\n state.session !== null\n );\n};\n\nconst toState = (test: Readonly<TestContext>, session: Readonly<SessionContext>): QtiTestState => ({\n version: QTI_TEST_STATE_VERSION,\n test: {\n items: (test?.items ?? [])\n .filter(item => item.identifier)\n .map(item => ({\n identifier: item.identifier,\n variables: (item.variables ?? []).map(v => ({\n identifier: v.identifier,\n ...(v.type ? { type: v.type } : {}),\n value: copy(v.value)\n })),\n ...(item.state ? { state: { ...item.state } } : {})\n })),\n outcomes: (test?.testOutcomeVariables ?? []).map(v => ({ identifier: v.identifier, value: copy(v.value) }))\n },\n session: {\n ...(session?.navPartId !== undefined ? { navPartId: session.navPartId } : {}),\n ...(session?.navSectionId !== undefined ? { navSectionId: session.navSectionId } : {}),\n ...(session?.navItemRefId !== undefined ? { navItemRefId: session.navItemRefId } : {})\n }\n});\n\n/**\n * Persist and resume a test session through one value, `state`, and one event,\n * `qti-state-changed`.\n *\n * Sits directly on top of `TestBaseMixin`, so its `qti-assessment-test-connected` listener runs\n * after the base has built `testContext.items` from the item-refs, and before the navigation\n * mixin's listener picks the first item to load.\n */\nexport const TestStateMixin = <T extends Constructor<TestBaseInterface>>(superClass: T) => {\n abstract class TestStateClass extends superClass implements ITestStateMixin {\n /** A state assigned before the test connected, applied when it does. */\n #pending: QtiTestState | null = null;\n\n /**\n * False while a test document is loading. Loading resets both contexts and rebuilds them, so\n * the intermediate states are empty — emitting one would invite a host to save it over the\n * real one.\n */\n #ready = false;\n\n #lastEmitted: string | null = null;\n\n constructor(...args: any[]) {\n super(...args);\n this.addEventListener('qti-testdoc-loaded', () => {\n this.#ready = false;\n this.#lastEmitted = null;\n });\n listenPublic(this, 'cito-test-loaded', () => {\n if (this.#pending) {\n this.#apply(this.#pending);\n this.#pending = null;\n }\n this.#ready = true;\n });\n }\n\n get state(): QtiTestState {\n return toState(this.testContext, this.sessionContext);\n }\n\n set state(value: QtiTestState) {\n if (!isQtiTestState(value)) {\n console.warn(`[qti-test] Ignoring a state that is not a version ${QTI_TEST_STATE_VERSION} QtiTestState.`);\n return;\n }\n if (!this.#ready) {\n this.#pending = value;\n return;\n }\n\n const { navItemRefId, navSectionId } = this.sessionContext;\n this.#apply(value);\n\n const restored = this.sessionContext;\n if (restored.navItemRefId && restored.navItemRefId !== navItemRefId) {\n this.#requestNavigation('item', restored.navItemRefId);\n } else if (!restored.navItemRefId && restored.navSectionId && restored.navSectionId !== navSectionId) {\n this.#requestNavigation('section', restored.navSectionId);\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n if (!this.#ready || !(changed.has('testContext') || changed.has('sessionContext'))) return;\n\n const state = this.state;\n const serialized = JSON.stringify(state);\n if (serialized === this.#lastEmitted) return;\n this.#lastEmitted = serialized;\n dispatchPublic(this, 'cito-test-state-changed', state);\n }\n\n #apply(state: QtiTestState): void {\n // Before the items load this only fills the test context; items already on screen are\n // updated too.\n for (const saved of state.test.items) this.updateItemVariables(saved.identifier, saved.variables, saved.state);\n\n const savedOutcomes = new Map(state.test.outcomes.map(outcome => [outcome.identifier, outcome.value]));\n this.testContext = {\n ...this.testContext,\n testOutcomeVariables: this.testContext.testOutcomeVariables?.map(v =>\n savedOutcomes.has(v.identifier) ? { ...v, value: copy(savedOutcomes.get(v.identifier)) } : v\n )\n };\n\n // Written before any navigation request, so the linear-mode restriction — which compares\n // against the current position — sees the restored item as current and lets it load.\n this.sessionContext = { ...this.sessionContext, ...this.#validSession(state.session) };\n }\n\n /** A stored position may point at an item or section a revised test no longer has. */\n #validSession(session: QtiTestStateSession): QtiTestStateSession {\n const exists = (selector: string, id: string | null | undefined) =>\n !!id && !!this._testElement?.querySelector(`${selector}[identifier=\"${CSS.escape(id)}\"]`);\n return {\n ...(exists('qti-test-part', session.navPartId) ? { navPartId: session.navPartId } : {}),\n ...(exists('qti-assessment-section', session.navSectionId) ? { navSectionId: session.navSectionId } : {}),\n ...(this.testContext.items.some(i => i.identifier === session.navItemRefId)\n ? { navItemRefId: session.navItemRefId }\n : {})\n };\n }\n\n #requestNavigation(type: 'item' | 'section', id: string): void {\n dispatchPublic(this, 'cito-test-navigate', { type, id });\n }\n }\n\n return TestStateClass as Constructor<ITestStateMixin> & T;\n};\n"]}
1
+ {"version":3,"file":"test-state.mixin.js","sourceRoot":"","sources":["../../src/mixins/test-state.mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgChE,MAAM,IAAI,GAAG,CAAC,KAAkC,EAAS,EAAE,CACzD,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,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EAAU;YACrD,cAAc,CAAC,IAAI,EAAE,oBAAoB,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAC3D,CAAC;KACF;IAED,OAAO,cAAkD,CAAC;AAC5D,CAAC,CAAC","sourcesContent":["import { QTI_TEST_STATE_VERSION } from '../types/qti-test-state';\nimport { dispatchPublic, listenPublic } from '../public-events';\n\nimport type { PropertyValues } from 'lit';\nimport type { SessionContext, TestContext } from '@qti-components/base';\nimport type { QtiTestState, QtiTestStateSession } from '../types/qti-test-state';\nimport type { TestBaseInterface } from './test-base';\n\ntype Constructor<T = {}> = abstract new (...args: any[]) => T;\ntype Value = string | string[] | null;\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'qti-state-changed': CustomEvent<QtiTestState>;\n }\n}\n\nexport interface ITestStateMixin {\n /**\n * The candidate's persistable state: what they answered and where they are.\n *\n * Assign a stored state to resume. It may be assigned at any time: before the test document\n * has loaded it is held and applied as soon as the test connects — before the first item\n * loads, so items and the initial navigation start from it — and after that it is applied\n * immediately and the test navigates to the restored position.\n *\n * Items are matched by item-ref identifier; items the state does not mention start fresh, and\n * stored items, test outcomes or a position the test no longer has are ignored. Restoring is a\n * resume, so linear-mode navigation restrictions do not apply.\n */\n state: QtiTestState;\n}\n\nconst copy = (value: Readonly<Value> | undefined): Value =>\n Array.isArray(value) ? [...value] : ((value as string | null | undefined) ?? null);\n\nconst isQtiTestState = (value: unknown): value is QtiTestState => {\n const state = value as QtiTestState | null;\n return (\n state?.version === QTI_TEST_STATE_VERSION &&\n Array.isArray(state.test?.items) &&\n Array.isArray(state.test?.outcomes) &&\n typeof state.session === 'object' &&\n state.session !== null\n );\n};\n\nconst toState = (test: Readonly<TestContext>, session: Readonly<SessionContext>): QtiTestState => ({\n version: QTI_TEST_STATE_VERSION,\n test: {\n items: (test?.items ?? [])\n .filter(item => item.identifier)\n .map(item => ({\n identifier: item.identifier,\n variables: (item.variables ?? []).map(v => ({\n identifier: v.identifier,\n ...(v.type ? { type: v.type } : {}),\n value: copy(v.value)\n })),\n ...(item.state ? { state: { ...item.state } } : {})\n })),\n outcomes: (test?.testOutcomeVariables ?? []).map(v => ({ identifier: v.identifier, value: copy(v.value) }))\n },\n session: {\n ...(session?.plugins && Object.keys(session.plugins).length > 0 ? { plugins: { ...session.plugins } } : {}),\n ...(session?.navPartId !== undefined ? { navPartId: session.navPartId } : {}),\n ...(session?.navSectionId !== undefined ? { navSectionId: session.navSectionId } : {}),\n ...(session?.navItemRefId !== undefined ? { navItemRefId: session.navItemRefId } : {})\n }\n});\n\n/**\n * Persist and resume a test session through one value, `state`, and one event,\n * `qti-state-changed`.\n *\n * Sits directly on top of `TestBaseMixin`, so its `qti-assessment-test-connected` listener runs\n * after the base has built `testContext.items` from the item-refs, and before the navigation\n * mixin's listener picks the first item to load.\n */\nexport const TestStateMixin = <T extends Constructor<TestBaseInterface>>(superClass: T) => {\n abstract class TestStateClass extends superClass implements ITestStateMixin {\n /** A state assigned before the test connected, applied when it does. */\n #pending: QtiTestState | null = null;\n\n /**\n * False while a test document is loading. Loading resets both contexts and rebuilds them, so\n * the intermediate states are empty — emitting one would invite a host to save it over the\n * real one.\n */\n #ready = false;\n\n #lastEmitted: string | null = null;\n\n constructor(...args: any[]) {\n super(...args);\n this.addEventListener('qti-testdoc-loaded', () => {\n this.#ready = false;\n this.#lastEmitted = null;\n });\n listenPublic(this, 'cito-test-update-plugin-state', ({ detail }) => this.#updatePluginState(detail));\n listenPublic(this, 'cito-test-loaded', () => {\n if (this.#pending) {\n this.#apply(this.#pending);\n this.#pending = null;\n }\n this.#ready = true;\n });\n }\n\n /** One plugin's entry, as JSON: the test stores it without reading it. `null` removes it. */\n #updatePluginState({ plugin, value }: { plugin: string; value: unknown }): void {\n if (typeof plugin !== 'string' || plugin === '') return;\n const { [plugin]: _removed, ...others } = this.sessionContext.plugins ?? {};\n let next: Record<string, unknown> = others;\n if (value !== null && value !== undefined) {\n try {\n next = { ...others, [plugin]: JSON.parse(JSON.stringify(value)) };\n } catch {\n console.warn(`[qti-test] Ignoring plugin state for \"${plugin}\": it is not JSON.`);\n return;\n }\n }\n this.sessionContext = { ...this.sessionContext, plugins: next };\n }\n\n get state(): QtiTestState {\n return toState(this.testContext, this.sessionContext);\n }\n\n set state(value: QtiTestState) {\n if (!isQtiTestState(value)) {\n console.warn(`[qti-test] Ignoring a state that is not a version ${QTI_TEST_STATE_VERSION} QtiTestState.`);\n return;\n }\n if (!this.#ready) {\n this.#pending = value;\n return;\n }\n\n const { navItemRefId, navSectionId } = this.sessionContext;\n this.#apply(value);\n\n const restored = this.sessionContext;\n if (restored.navItemRefId && restored.navItemRefId !== navItemRefId) {\n this.#requestNavigation('item', restored.navItemRefId);\n } else if (!restored.navItemRefId && restored.navSectionId && restored.navSectionId !== navSectionId) {\n this.#requestNavigation('section', restored.navSectionId);\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n if (!this.#ready || !(changed.has('testContext') || changed.has('sessionContext'))) return;\n\n const state = this.state;\n const serialized = JSON.stringify(state);\n if (serialized === this.#lastEmitted) return;\n this.#lastEmitted = serialized;\n dispatchPublic(this, 'cito-test-state-changed', state);\n }\n\n #apply(state: QtiTestState): void {\n // Before the items load this only fills the test context; items already on screen are\n // updated too.\n for (const saved of state.test.items) this.updateItemVariables(saved.identifier, saved.variables, saved.state);\n\n const savedOutcomes = new Map(state.test.outcomes.map(outcome => [outcome.identifier, outcome.value]));\n this.testContext = {\n ...this.testContext,\n testOutcomeVariables: this.testContext.testOutcomeVariables?.map(v =>\n savedOutcomes.has(v.identifier) ? { ...v, value: copy(savedOutcomes.get(v.identifier)) } : v\n )\n };\n\n // Written before any navigation request, so the linear-mode restriction — which compares\n // against the current position — sees the restored item as current and lets it load.\n // Plugins are replaced, not merged: a state without them clears what an earlier one left.\n this.sessionContext = {\n ...this.sessionContext,\n ...this.#validSession(state.session),\n plugins: state.session.plugins && typeof state.session.plugins === 'object' ? { ...state.session.plugins } : {}\n };\n }\n\n /** A stored position may point at an item or section a revised test no longer has. */\n #validSession(session: QtiTestStateSession): QtiTestStateSession {\n const exists = (selector: string, id: string | null | undefined) =>\n !!id && !!this._testElement?.querySelector(`${selector}[identifier=\"${CSS.escape(id)}\"]`);\n return {\n ...(exists('qti-test-part', session.navPartId) ? { navPartId: session.navPartId } : {}),\n ...(exists('qti-assessment-section', session.navSectionId) ? { navSectionId: session.navSectionId } : {}),\n ...(this.testContext.items.some(i => i.identifier === session.navItemRefId)\n ? { navItemRefId: session.navItemRefId }\n : {})\n };\n }\n\n #requestNavigation(type: 'item' | 'section', id: string): void {\n dispatchPublic(this, 'cito-test-navigate', { type, id });\n }\n }\n\n return TestStateClass as Constructor<ITestStateMixin> & T;\n};\n"]}
@@ -0,0 +1,8 @@
1
+ import type { ComputedContext } from '@qti-components/base';
2
+ import type { QtiTestPluginState } from './types/qti-test-state';
3
+ /**
4
+ * A plugin's entry in the state, typed through `QtiTestPluginState`, or `undefined` before the
5
+ * plugin has stored anything. Read it from `computedContext`; write it by dispatching
6
+ * `cito-test-update-plugin-state` (`dispatchPublic`).
7
+ */
8
+ export declare const pluginState: <K extends keyof QtiTestPluginState & string>(context: Pick<ComputedContext, "plugins"> | undefined, plugin: K) => QtiTestPluginState[K] | undefined;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A plugin's entry in the state, typed through `QtiTestPluginState`, or `undefined` before the
3
+ * plugin has stored anything. Read it from `computedContext`; write it by dispatching
4
+ * `cito-test-update-plugin-state` (`dispatchPublic`).
5
+ */
6
+ export const pluginState = (context, plugin) => context?.plugins?.[plugin];
7
+ //# sourceMappingURL=plugin-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-state.js","sourceRoot":"","sources":["../src/plugin-state.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,OAAqD,EACrD,MAAS,EAC0B,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,MAAM,CAAsC,CAAC","sourcesContent":["import type { ComputedContext } from '@qti-components/base';\nimport type { QtiTestPluginState } from './types/qti-test-state';\n\n/**\n * A plugin's entry in the state, typed through `QtiTestPluginState`, or `undefined` before the\n * plugin has stored anything. Read it from `computedContext`; write it by dispatching\n * `cito-test-update-plugin-state` (`dispatchPublic`).\n */\nexport const pluginState = <K extends keyof QtiTestPluginState & string>(\n context: Pick<ComputedContext, 'plugins'> | undefined,\n plugin: K\n): QtiTestPluginState[K] | undefined => context?.plugins?.[plugin] as QtiTestPluginState[K] | undefined;\n"]}
@@ -0,0 +1,71 @@
1
+ import { TestBookmark } from '../components/test-bookmark/test-bookmark';
2
+ import { TestCheckItem } from '../components/test-check-item/test-check-item';
3
+ import { TestPrintContext } from '../components/test-print-context/test-print-context';
4
+ import { TestPrintVariables } from '../components/test-print-item-variables/test-print-item-variables';
5
+ import { TestScoringButtons } from '../components/test-scoring-buttons/test-scoring-buttons';
6
+ import { TestScoringFeedback } from '../components/test-scoring-feedback/test-scoring-feedback';
7
+ import { TestStamp } from '../components/test-stamp/test-stamp';
8
+ import { TestView } from '../components/test-view-toggle/test-view';
9
+ import { TestViewToggle } from '../components/test-view-toggle/test-view-toggle';
10
+ export * from '../tts/elements';
11
+ export { bookmarkedItems } from '../components/test-bookmark/test-bookmark';
12
+ export { TestCheckItem, TestBookmark, TestPrintContext, TestPrintVariables, TestScoringButtons, TestScoringFeedback, TestStamp, TestView, TestViewToggle };
13
+ /**
14
+ * Every test plugin's elements in one list. `qti-test` registers them with the rest of its
15
+ * elements, and a scoped registry can use the list directly. Defines nothing.
16
+ *
17
+ * A plugin is the set of files listed for it in `plugin-boundary.spec.ts` (`PLUGINS`); this file is
18
+ * the one place that names them all.
19
+ */
20
+ export declare const pluginElements: readonly [{
21
+ readonly tag: "test-check-item";
22
+ readonly ctor: typeof TestCheckItem;
23
+ }, {
24
+ readonly tag: "test-bookmark";
25
+ readonly ctor: typeof TestBookmark;
26
+ }, {
27
+ readonly tag: "test-print-context";
28
+ readonly ctor: typeof TestPrintContext;
29
+ }, {
30
+ readonly tag: "test-print-item-variables";
31
+ readonly ctor: typeof TestPrintVariables;
32
+ }, {
33
+ readonly tag: "test-scoring-buttons";
34
+ readonly ctor: typeof TestScoringButtons;
35
+ }, {
36
+ readonly tag: "test-scoring-feedback";
37
+ readonly ctor: typeof TestScoringFeedback;
38
+ }, {
39
+ readonly tag: "test-stamp";
40
+ readonly ctor: typeof TestStamp;
41
+ }, {
42
+ readonly tag: "test-view";
43
+ readonly ctor: typeof TestView;
44
+ }, {
45
+ readonly tag: "test-view-toggle";
46
+ readonly ctor: typeof TestViewToggle;
47
+ }, {
48
+ readonly tag: "test-item-to-speech";
49
+ readonly ctor: typeof import("./elements").TestItemToSpeech;
50
+ }, {
51
+ readonly tag: "test-tts-next";
52
+ readonly ctor: typeof import("./elements").TestTtsNext;
53
+ }, {
54
+ readonly tag: "test-tts-pause";
55
+ readonly ctor: typeof import("./elements").TestTtsPause;
56
+ }, {
57
+ readonly tag: "test-tts-pick";
58
+ readonly ctor: typeof import("./elements").TestTtsPick;
59
+ }, {
60
+ readonly tag: "test-tts-play";
61
+ readonly ctor: typeof import("./elements").TestTtsPlay;
62
+ }, {
63
+ readonly tag: "test-tts-prev";
64
+ readonly ctor: typeof import("./elements").TestTtsPrev;
65
+ }, {
66
+ readonly tag: "test-tts-resume";
67
+ readonly ctor: typeof import("./elements").TestTtsResume;
68
+ }, {
69
+ readonly tag: "test-tts-stop";
70
+ readonly ctor: typeof import("./elements").TestTtsStop;
71
+ }];
@@ -0,0 +1,33 @@
1
+ import { TestBookmark } from '../components/test-bookmark/test-bookmark';
2
+ import { TestCheckItem } from '../components/test-check-item/test-check-item';
3
+ import { TestPrintContext } from '../components/test-print-context/test-print-context';
4
+ import { TestPrintVariables } from '../components/test-print-item-variables/test-print-item-variables';
5
+ import { TestScoringButtons } from '../components/test-scoring-buttons/test-scoring-buttons';
6
+ import { TestScoringFeedback } from '../components/test-scoring-feedback/test-scoring-feedback';
7
+ import { TestStamp } from '../components/test-stamp/test-stamp';
8
+ import { TestView } from '../components/test-view-toggle/test-view';
9
+ import { TestViewToggle } from '../components/test-view-toggle/test-view-toggle';
10
+ import { ttsElements } from '../tts/elements';
11
+ export * from '../tts/elements';
12
+ export { bookmarkedItems } from '../components/test-bookmark/test-bookmark';
13
+ export { TestCheckItem, TestBookmark, TestPrintContext, TestPrintVariables, TestScoringButtons, TestScoringFeedback, TestStamp, TestView, TestViewToggle };
14
+ /**
15
+ * Every test plugin's elements in one list. `qti-test` registers them with the rest of its
16
+ * elements, and a scoped registry can use the list directly. Defines nothing.
17
+ *
18
+ * A plugin is the set of files listed for it in `plugin-boundary.spec.ts` (`PLUGINS`); this file is
19
+ * the one place that names them all.
20
+ */
21
+ export const pluginElements = [
22
+ { tag: 'test-check-item', ctor: TestCheckItem },
23
+ { tag: 'test-bookmark', ctor: TestBookmark },
24
+ { tag: 'test-print-context', ctor: TestPrintContext },
25
+ { tag: 'test-print-item-variables', ctor: TestPrintVariables },
26
+ { tag: 'test-scoring-buttons', ctor: TestScoringButtons },
27
+ { tag: 'test-scoring-feedback', ctor: TestScoringFeedback },
28
+ { tag: 'test-stamp', ctor: TestStamp },
29
+ { tag: 'test-view', ctor: TestView },
30
+ { tag: 'test-view-toggle', ctor: TestViewToggle },
31
+ ...ttsElements
32
+ ];
33
+ //# sourceMappingURL=elements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/plugins/elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mEAAmE,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yDAAyD,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAE5E,OAAO,EACL,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,cAAc,EACf,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,aAAa,EAAE;IAC/C,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,YAAY,EAAE;IAC5C,EAAE,GAAG,EAAE,oBAAoB,EAAE,IAAI,EAAE,gBAAgB,EAAE;IACrD,EAAE,GAAG,EAAE,2BAA2B,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC9D,EAAE,GAAG,EAAE,sBAAsB,EAAE,IAAI,EAAE,kBAAkB,EAAE;IACzD,EAAE,GAAG,EAAE,uBAAuB,EAAE,IAAI,EAAE,mBAAmB,EAAE;IAC3D,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE;IACtC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;IACpC,EAAE,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,EAAE;IACjD,GAAG,WAAW;CACN,CAAC","sourcesContent":["import { TestBookmark } from '../components/test-bookmark/test-bookmark';\nimport { TestCheckItem } from '../components/test-check-item/test-check-item';\nimport { TestPrintContext } from '../components/test-print-context/test-print-context';\nimport { TestPrintVariables } from '../components/test-print-item-variables/test-print-item-variables';\nimport { TestScoringButtons } from '../components/test-scoring-buttons/test-scoring-buttons';\nimport { TestScoringFeedback } from '../components/test-scoring-feedback/test-scoring-feedback';\nimport { TestStamp } from '../components/test-stamp/test-stamp';\nimport { TestView } from '../components/test-view-toggle/test-view';\nimport { TestViewToggle } from '../components/test-view-toggle/test-view-toggle';\nimport { ttsElements } from '../tts/elements';\n\nexport * from '../tts/elements';\n\nexport { bookmarkedItems } from '../components/test-bookmark/test-bookmark';\n\nexport {\n TestCheckItem,\n TestBookmark,\n TestPrintContext,\n TestPrintVariables,\n TestScoringButtons,\n TestScoringFeedback,\n TestStamp,\n TestView,\n TestViewToggle\n};\n\n/**\n * Every test plugin's elements in one list. `qti-test` registers them with the rest of its\n * elements, and a scoped registry can use the list directly. Defines nothing.\n *\n * A plugin is the set of files listed for it in `plugin-boundary.spec.ts` (`PLUGINS`); this file is\n * the one place that names them all.\n */\nexport const pluginElements = [\n { tag: 'test-check-item', ctor: TestCheckItem },\n { tag: 'test-bookmark', ctor: TestBookmark },\n { tag: 'test-print-context', ctor: TestPrintContext },\n { tag: 'test-print-item-variables', ctor: TestPrintVariables },\n { tag: 'test-scoring-buttons', ctor: TestScoringButtons },\n { tag: 'test-scoring-feedback', ctor: TestScoringFeedback },\n { tag: 'test-stamp', ctor: TestStamp },\n { tag: 'test-view', ctor: TestView },\n { tag: 'test-view-toggle', ctor: TestViewToggle },\n ...ttsElements\n] as const;\n"]}
@@ -0,0 +1,2 @@
1
+ /** The test plugins: print, scoring, stamp, text-to-speech and view. The core composes them here and nowhere else. */
2
+ export * from './elements.js';
@@ -0,0 +1,3 @@
1
+ /** The test plugins: print, scoring, stamp, text-to-speech and view. The core composes them here and nowhere else. */
2
+ export * from './elements.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,cAAc,eAAe,CAAC","sourcesContent":["/** The test plugins: print, scoring, stamp, text-to-speech and view. The core composes them here and nowhere else. */\nexport * from './elements.js';\n"]}
@@ -30,6 +30,11 @@ export interface PublicEventMap {
30
30
  value: number | string;
31
31
  }>;
32
32
  'cito-test-switch-view': CustomEvent<View>;
33
+ /** `value` is JSON; `null` or `undefined` removes the plugin's entry. */
34
+ 'cito-test-update-plugin-state': CustomEvent<{
35
+ plugin: string;
36
+ value: unknown;
37
+ }>;
33
38
  'cito-test-navigated': CustomEvent<NavigationTarget>;
34
39
  'cito-test-navigation-started': CustomEvent<NavigationTarget>;
35
40
  'cito-test-navigation-failed': CustomEvent<NavigationFailure>;
@@ -3,6 +3,7 @@ export const PUBLIC_EVENTS = {
3
3
  'cito-test-navigate': { kind: 'request', scope: 'test', deprecated: 'qti-request-navigation' },
4
4
  'cito-test-end-attempt': { kind: 'request', scope: 'test', deprecated: 'test-end-attempt' },
5
5
  'cito-test-update-outcome': { kind: 'request', scope: 'test', deprecated: 'test-update-outcome-variable' },
6
+ 'cito-test-update-plugin-state': { kind: 'request', scope: 'test' },
6
7
  'cito-test-switch-view': { kind: 'request', scope: 'test', deprecated: 'on-test-switch-view' },
7
8
  'cito-test-navigated': { kind: 'notification', scope: 'test' },
8
9
  'cito-test-navigation-started': {