@qti-components/test 1.8.0 → 1.10.0-next.0

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 (74) hide show
  1. package/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.d.ts +4 -0
  2. package/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js +16 -28
  3. package/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js.map +1 -1
  4. package/dist/components/qti-assessment-test/qti-assessment-test.d.ts +5 -0
  5. package/dist/components/qti-assessment-test/qti-assessment-test.js +2 -5
  6. package/dist/components/qti-assessment-test/qti-assessment-test.js.map +1 -1
  7. package/dist/components/qti-number-selected/qti-number-selected.js +2 -1
  8. package/dist/components/qti-number-selected/qti-number-selected.js.map +1 -1
  9. package/dist/components/qti-test/qti-test.d.ts +16 -2
  10. package/dist/components/qti-test/qti-test.js +33 -6
  11. package/dist/components/qti-test/qti-test.js.map +1 -1
  12. package/dist/components/qti-test-variables/qti-test-variables.js +2 -1
  13. package/dist/components/qti-test-variables/qti-test-variables.js.map +1 -1
  14. package/dist/components/test-check-item/test-check-item.d.ts +2 -0
  15. package/dist/components/test-check-item/test-check-item.js +16 -3
  16. package/dist/components/test-check-item/test-check-item.js.map +1 -1
  17. package/dist/components/test-container/test-container.d.ts +3 -0
  18. package/dist/components/test-container/test-container.js +5 -1
  19. package/dist/components/test-container/test-container.js.map +1 -1
  20. package/dist/components/test-end-attempt/test-end-attempt.js +2 -1
  21. package/dist/components/test-end-attempt/test-end-attempt.js.map +1 -1
  22. package/dist/components/test-item-link/test-item-link.js +2 -8
  23. package/dist/components/test-item-link/test-item-link.js.map +1 -1
  24. package/dist/components/test-item-to-speech/test-item-to-speech.d.ts +61 -15
  25. package/dist/components/test-item-to-speech/test-item-to-speech.js +287 -103
  26. package/dist/components/test-item-to-speech/test-item-to-speech.js.map +1 -1
  27. package/dist/components/test-navigation/test-navigation.d.ts +9 -9
  28. package/dist/components/test-navigation/test-navigation.js +68 -21
  29. package/dist/components/test-navigation/test-navigation.js.map +1 -1
  30. package/dist/components/test-next/test-next.js +2 -8
  31. package/dist/components/test-next/test-next.js.map +1 -1
  32. package/dist/components/test-prev/test-prev.js +2 -8
  33. package/dist/components/test-prev/test-prev.js.map +1 -1
  34. package/dist/components/test-scoring-buttons/test-scoring-buttons.d.ts +1 -1
  35. package/dist/components/test-scoring-buttons/test-scoring-buttons.js +6 -8
  36. package/dist/components/test-scoring-buttons/test-scoring-buttons.js.map +1 -1
  37. package/dist/components/test-section-link/test-section-link.js +2 -8
  38. package/dist/components/test-section-link/test-section-link.js.map +1 -1
  39. package/dist/components/test-view-toggle/test-view-toggle.js +2 -5
  40. package/dist/components/test-view-toggle/test-view-toggle.js.map +1 -1
  41. package/dist/components/test-view-toggle/test-view.js +2 -5
  42. package/dist/components/test-view-toggle/test-view.js.map +1 -1
  43. package/dist/index.d.ts +1 -0
  44. package/dist/index.js +1 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/internal/item-ref-selection.js.map +1 -1
  47. package/dist/internal/test-host.context.d.ts +24 -0
  48. package/dist/internal/test-host.context.js +3 -0
  49. package/dist/internal/test-host.context.js.map +1 -0
  50. package/dist/mixins/index.d.ts +1 -0
  51. package/dist/mixins/index.js +1 -0
  52. package/dist/mixins/index.js.map +1 -1
  53. package/dist/mixins/test-base.d.ts +7 -2
  54. package/dist/mixins/test-base.js +55 -20
  55. package/dist/mixins/test-base.js.map +1 -1
  56. package/dist/mixins/test-navigation.mixin.d.ts +3 -4
  57. package/dist/mixins/test-navigation.mixin.js +26 -40
  58. package/dist/mixins/test-navigation.mixin.js.map +1 -1
  59. package/dist/mixins/test-processing.mixin.js +3 -1
  60. package/dist/mixins/test-processing.mixin.js.map +1 -1
  61. package/dist/mixins/test-state.mixin.d.ts +33 -0
  62. package/dist/mixins/test-state.mixin.js +131 -0
  63. package/dist/mixins/test-state.mixin.js.map +1 -0
  64. package/dist/mixins/test-view.mixin.js +3 -2
  65. package/dist/mixins/test-view.mixin.js.map +1 -1
  66. package/dist/public-events.d.ts +62 -0
  67. package/dist/public-events.js +33 -0
  68. package/dist/public-events.js.map +1 -0
  69. package/dist/types/iqti-test.d.ts +8 -5
  70. package/dist/types/iqti-test.js.map +1 -1
  71. package/dist/types/qti-test-state.d.ts +45 -0
  72. package/dist/types/qti-test-state.js +2 -0
  73. package/dist/types/qti-test-state.js.map +1 -0
  74. package/package.json +5 -5
@@ -1,16 +1,19 @@
1
1
  import type { ITestNavigationMixin } from '../mixins/test-navigation.mixin';
2
+ import type { ITestStateMixin } from '../mixins/test-state.mixin';
3
+ import type { ItemVariableValue } from '../mixins/test-base';
2
4
  import type { LitElement } from 'lit';
3
- import type { ConfigContext, TestContext } from '@qti-components/base';
5
+ import type { ConfigContext, ItemContext, TestContext } from '@qti-components/base';
4
6
  import type { SessionContext } from '@qti-components/base';
5
- import type { OutcomeVariable, VariableDeclaration, VariableValue } from '@qti-components/base';
6
- export type { ITestNavigationMixin };
7
- export interface IQtiTest extends LitElement, ITestNavigationMixin, ITestProcessingMixin, IMyQtiTest {
7
+ import type { OutcomeVariable, VariableDeclaration } from '@qti-components/base';
8
+ export type { ITestNavigationMixin, ITestStateMixin };
9
+ export interface IQtiTest extends LitElement, ITestNavigationMixin, ITestProcessingMixin, ITestStateMixin, IMyQtiTest {
8
10
  }
9
11
  export interface IMyQtiTest {
10
12
  testContext: Readonly<TestContext>;
11
13
  sessionContext: Readonly<SessionContext>;
12
14
  configContext: ConfigContext;
13
- updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void;
15
+ /** Sets values on one item, keyed by its `qti-assessment-item-ref` identifier. */
16
+ updateItemVariables(itemRefID: string, variables: readonly ItemVariableValue[], state?: ItemContext['state']): void;
14
17
  }
15
18
  export interface ITestProcessingMixin {
16
19
  updateOutcomeVariable(identifier: string, value: string | string[] | undefined): void;
@@ -1 +1 @@
1
- {"version":3,"file":"iqti-test.js","sourceRoot":"","sources":["../../src/types/iqti-test.ts"],"names":[],"mappings":"","sourcesContent":["import type { ITestNavigationMixin } from '../mixins/test-navigation.mixin';\nimport type { LitElement } from 'lit';\nimport type { ConfigContext, TestContext } from '@qti-components/base';\nimport type { SessionContext } from '@qti-components/base';\nimport type { OutcomeVariable, VariableDeclaration, VariableValue } from '@qti-components/base';\n\n/*\n * `ITestNavigationMixin` is declared beside the class it describes, in\n * ../mixins/test-navigation.mixin, and re-exported here so this module's public surface is\n * unchanged. Keeping the declaration there is what lets the mixin `implements` it — the\n * compiler then holds the interface and the class together — while the imports still run\n * one way, types -> mixin, which `pnpm madge` requires.\n */\nexport type { ITestNavigationMixin };\n\nexport interface IQtiTest extends LitElement, ITestNavigationMixin, ITestProcessingMixin, IMyQtiTest {}\n\nexport interface IMyQtiTest {\n // Properties from TestBase\n testContext: Readonly<TestContext>;\n sessionContext: Readonly<SessionContext>;\n configContext: ConfigContext;\n\n // Methods from TestBase\n updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void;\n}\n\nexport interface ITestProcessingMixin {\n // Methods from TestProcessingMixin\n updateOutcomeVariable(identifier: string, value: string | string[] | undefined): void;\n getOutcome(identifier: string): Readonly<OutcomeVariable>;\n getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>>;\n outcomeProcessing(): boolean;\n}\n"]}
1
+ {"version":3,"file":"iqti-test.js","sourceRoot":"","sources":["../../src/types/iqti-test.ts"],"names":[],"mappings":"","sourcesContent":["import type { ITestNavigationMixin } from '../mixins/test-navigation.mixin';\nimport type { ITestStateMixin } from '../mixins/test-state.mixin';\nimport type { ItemVariableValue } from '../mixins/test-base';\nimport type { LitElement } from 'lit';\nimport type { ConfigContext, ItemContext, TestContext } from '@qti-components/base';\nimport type { SessionContext } from '@qti-components/base';\nimport type { OutcomeVariable, VariableDeclaration } from '@qti-components/base';\n\n/*\n * `ITestNavigationMixin` is declared beside the class it describes, in\n * ../mixins/test-navigation.mixin, and re-exported here so this module's public surface is\n * unchanged. Keeping the declaration there is what lets the mixin `implements` it — the\n * compiler then holds the interface and the class together — while the imports still run\n * one way, types -> mixin, which `pnpm madge` requires.\n */\nexport type { ITestNavigationMixin, ITestStateMixin };\n\nexport interface IQtiTest extends LitElement, ITestNavigationMixin, ITestProcessingMixin, ITestStateMixin, IMyQtiTest {}\n\nexport interface IMyQtiTest {\n // Properties from TestBase\n testContext: Readonly<TestContext>;\n sessionContext: Readonly<SessionContext>;\n configContext: ConfigContext;\n\n // Methods from TestBase\n /** Sets values on one item, keyed by its `qti-assessment-item-ref` identifier. */\n updateItemVariables(itemRefID: string, variables: readonly ItemVariableValue[], state?: ItemContext['state']): void;\n}\n\nexport interface ITestProcessingMixin {\n // Methods from TestProcessingMixin\n updateOutcomeVariable(identifier: string, value: string | string[] | undefined): void;\n getOutcome(identifier: string): Readonly<OutcomeVariable>;\n getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>>;\n outcomeProcessing(): boolean;\n}\n"]}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Everything a host needs to persist to resume a candidate's test session, and nothing else.
3
+ *
4
+ * Read it from `qtiTest.state` or the `qti-state-changed` event, store it wherever you like —
5
+ * a database, `localStorage`, `sessionStorage` — and assign it back to `qtiTest.state` to resume.
6
+ *
7
+ * Deliberately not here:
8
+ * - declaration metadata (`baseType`, `cardinality`, `correctResponse`, `mapping`, …): it comes
9
+ * from the item XML on every load, and persisting the answer key with the candidate's data is
10
+ * both bloat and a leak;
11
+ * - `configContext` and `qtiContext`: inputs the host supplies on every load, not session state.
12
+ * The shuffle `seed` in particular must be passed in again, or the restored order changes;
13
+ * - `view`: a role the host decides, not something the candidate produced;
14
+ * - anything computed — scores per section, `done`, `active` — which is rederived from this.
15
+ */
16
+ export interface QtiTestState {
17
+ /** Bumped on any incompatible change to this shape. A state with another version is ignored. */
18
+ version: 1;
19
+ test: {
20
+ items: QtiTestStateItem[];
21
+ /** Test-level outcome values. Only outcomes the test declares are restored. */
22
+ outcomes: QtiTestStateValue[];
23
+ };
24
+ session: QtiTestStateSession;
25
+ }
26
+ export interface QtiTestStateItem {
27
+ /** The `qti-assessment-item-ref` identifier. */
28
+ identifier: string;
29
+ variables: (QtiTestStateValue & {
30
+ type?: 'response' | 'outcome' | 'template' | 'context';
31
+ })[];
32
+ /** Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`. */
33
+ state?: Record<string, string | null>;
34
+ }
35
+ export interface QtiTestStateValue {
36
+ identifier: string;
37
+ value: string | string[] | null;
38
+ }
39
+ /** Where the candidate is. */
40
+ export interface QtiTestStateSession {
41
+ navPartId?: string | null;
42
+ navSectionId?: string | null;
43
+ navItemRefId?: string | null;
44
+ }
45
+ export declare const QTI_TEST_STATE_VERSION = 1;
@@ -0,0 +1,2 @@
1
+ export const QTI_TEST_STATE_VERSION = 1;
2
+ //# sourceMappingURL=qti-test-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-test-state.js","sourceRoot":"","sources":["../../src/types/qti-test-state.ts"],"names":[],"mappings":"AA8CA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC","sourcesContent":["/**\n * Everything a host needs to persist to resume a candidate's test session, and nothing else.\n *\n * Read it from `qtiTest.state` or the `qti-state-changed` event, store it wherever you like —\n * a database, `localStorage`, `sessionStorage` — and assign it back to `qtiTest.state` to resume.\n *\n * Deliberately not here:\n * - declaration metadata (`baseType`, `cardinality`, `correctResponse`, `mapping`, …): it comes\n * from the item XML on every load, and persisting the answer key with the candidate's data is\n * both bloat and a leak;\n * - `configContext` and `qtiContext`: inputs the host supplies on every load, not session state.\n * The shuffle `seed` in particular must be passed in again, or the restored order changes;\n * - `view`: a role the host decides, not something the candidate produced;\n * - anything computed — scores per section, `done`, `active` — which is rederived from this.\n */\nexport interface QtiTestState {\n /** Bumped on any incompatible change to this shape. A state with another version is ignored. */\n version: 1;\n test: {\n items: QtiTestStateItem[];\n /** Test-level outcome values. Only outcomes the test declares are restored. */\n outcomes: QtiTestStateValue[];\n };\n session: QtiTestStateSession;\n}\n\nexport interface QtiTestStateItem {\n /** The `qti-assessment-item-ref` identifier. */\n identifier: string;\n variables: (QtiTestStateValue & { type?: 'response' | 'outcome' | 'template' | 'context' })[];\n /** Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`. */\n state?: Record<string, string | null>;\n}\n\nexport interface QtiTestStateValue {\n identifier: string;\n value: string | string[] | null;\n}\n\n/** Where the candidate is. */\nexport interface QtiTestStateSession {\n navPartId?: string | null;\n navSectionId?: string | null;\n navItemRefId?: string | null;\n}\n\nexport const QTI_TEST_STATE_VERSION = 1;\n"]}
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@qti-components/test",
3
3
  "description": "QTI test utilities",
4
- "version": "1.8.0",
4
+ "version": "1.10.0-next.0",
5
5
  "author": "",
6
6
  "dependencies": {
7
7
  "@heximal/templates": "^0.1.5",
8
- "@qti-components/base": "^2.3.0",
9
- "@qti-components/elements": "^1.8.0",
10
- "@qti-components/interactions": "^1.10.4",
8
+ "@qti-components/base": "^2.4.0",
9
+ "@qti-components/elements": "^1.10.0-next.0",
10
+ "@qti-components/interactions": "^1.10.5-next.0",
11
11
  "@qti-components/processing": "^1.6.0",
12
- "@qti-components/theme": "^2.2.1",
12
+ "@qti-components/theme": "^2.2.2-next.0",
13
13
  "@qti-components/transformers": "^1.7.3",
14
14
  "@qti-components/utilities": "^1.3.3"
15
15
  },