@citolab/qti-components 10.0.0-next.3 → 10.0.0-next.31

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 (94) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +4335 -2689
  3. package/dist/base.d.ts +39 -13
  4. package/dist/base.js +14 -1
  5. package/dist/{chunk-OQDBARD5.js → chunk-3HG5GIKR.js} +2 -2
  6. package/dist/{chunk-RU6332MD.js → chunk-566LB3G2.js} +4 -4
  7. package/dist/{chunk-MI7774NV.js → chunk-5BP2A7BI.js} +2 -2
  8. package/dist/{chunk-D3BYGEQU.js → chunk-5LNSB6J6.js} +117 -92
  9. package/dist/chunk-5LNSB6J6.js.map +1 -0
  10. package/dist/chunk-7ISPUOJG.js +209 -0
  11. package/dist/chunk-7ISPUOJG.js.map +1 -0
  12. package/dist/{chunk-GBZNFSFY.js → chunk-ADTCTKXS.js} +2 -2
  13. package/dist/{chunk-FD4AB6TM.js → chunk-BBP7QV32.js} +2 -2
  14. package/dist/{chunk-LFVPS7KB.js → chunk-CFTWXYBO.js} +2 -2
  15. package/dist/{chunk-35WWWFS6.js → chunk-DAESCCLR.js} +2 -2
  16. package/dist/chunk-DJ7PB252.js +7 -0
  17. package/dist/chunk-DJ7PB252.js.map +1 -0
  18. package/dist/{chunk-6U3YPHXU.js → chunk-GAPMCYR5.js} +277 -154
  19. package/dist/chunk-GAPMCYR5.js.map +1 -0
  20. package/dist/{chunk-TDWJ6WZA.js → chunk-GPC53O7P.js} +166 -10
  21. package/dist/chunk-GPC53O7P.js.map +1 -0
  22. package/dist/{chunk-6K3QWJHH.js → chunk-LPYZVKHX.js} +48 -7
  23. package/dist/chunk-LPYZVKHX.js.map +1 -0
  24. package/dist/{chunk-TLAVOBEM.js → chunk-O2XRZPKA.js} +356 -62
  25. package/dist/chunk-O2XRZPKA.js.map +1 -0
  26. package/dist/chunk-PZ5AY32C.js +10 -0
  27. package/dist/chunk-PZ5AY32C.js.map +1 -0
  28. package/dist/{chunk-SIE3E4FG.js → chunk-R352K4KZ.js} +966 -2078
  29. package/dist/chunk-R352K4KZ.js.map +1 -0
  30. package/dist/{chunk-RSMYGGQK.js → chunk-TZCOXFPB.js} +1590 -610
  31. package/dist/chunk-TZCOXFPB.js.map +1 -0
  32. package/dist/chunk-UCXLDQYA.js +56 -0
  33. package/dist/chunk-UCXLDQYA.js.map +1 -0
  34. package/dist/chunk-WWY2H2YO.js +7 -0
  35. package/dist/chunk-WWY2H2YO.js.map +1 -0
  36. package/dist/computed.types.d-D06SAPP2.d.ts +131 -0
  37. package/dist/{config.context.d-BvU9r-Mg.d.ts → config.context.d-Dm11aAuw.d.ts} +21 -3
  38. package/dist/corrections.d.ts +137 -24
  39. package/dist/corrections.js +12 -12
  40. package/dist/corrections.js.map +1 -1
  41. package/dist/elements.d.ts +66 -73
  42. package/dist/elements.js +9 -6
  43. package/dist/index.d.ts +21 -17
  44. package/dist/index.js +50 -61
  45. package/dist/interactions.d.ts +98 -19
  46. package/dist/interactions.js +8 -3
  47. package/dist/item.css +1948 -1946
  48. package/dist/item.d.ts +8 -6
  49. package/dist/item.js +6 -5
  50. package/dist/item.types.d-Zc6ZQDhu.d.ts +25 -0
  51. package/dist/loader.d.ts +5 -3
  52. package/dist/loader.js +3 -2
  53. package/dist/processing.d.ts +19 -7
  54. package/dist/processing.js +4 -3
  55. package/dist/public-events.d-3dGip9pd.d.ts +105 -0
  56. package/dist/qti-components-jsx.d.ts +1725 -1777
  57. package/dist/{qti-condition-expression.d-VJH6cWxf.d.ts → qti-condition-expression.d-7Kd4LBxn.d.ts} +1 -1
  58. package/dist/{qti-expression.d-BPxEp8HU.d.ts → qti-expression.d-iH3w6mqf.d.ts} +2 -1
  59. package/dist/{qti-feedback.d-wMYNVkkj.d.ts → qti-feedback.d-CT0W-8Gm.d.ts} +8 -1
  60. package/dist/{qti-item.d-DgC1AQbY.d.ts → qti-item.d-CxP6KtCH.d.ts} +3 -2
  61. package/dist/{qti-rule-base.d-Bdzg8eGH.d.ts → qti-rule-base.d-CeKP0Ooi.d.ts} +2 -2
  62. package/dist/qti-test-state-B7LgeKnN.d.ts +81 -0
  63. package/dist/qti-test-state.d-CjvdranT.d.ts +61 -0
  64. package/dist/{qti-test.d-86TlaMlI.d.ts → qti-test.d-DGXU-4tv.d.ts} +91 -487
  65. package/dist/{qti-text-entry-interaction.d-q8u5BiVK.d.ts → qti-text-entry-interaction.d-m0EFv9no.d.ts} +221 -73
  66. package/dist/{qti-transform-test.d-BL7GGFJj.d.ts → qti-transform-test.d-CtNaWJr8.d.ts} +9 -0
  67. package/dist/{interaction.d-g6XG0T0Z.d.ts → record.d-N1Bq7e1f.d.ts} +67 -4
  68. package/dist/{session.context.d-D5080LVx.d.ts → session.context.d-9gRdGK4T.d.ts} +7 -1
  69. package/dist/test-plugin-api.d.ts +143 -0
  70. package/dist/test-plugin-api.js +21 -0
  71. package/dist/test-plugin-api.js.map +1 -0
  72. package/dist/test.d.ts +72 -57
  73. package/dist/test.js +22 -48
  74. package/dist/transformers.d.ts +1 -1
  75. package/dist/transformers.js +2 -1
  76. package/dist/{item.types.d-B55QkJ92.d.ts → variables.d-DWHlTszN.d.ts} +8 -24
  77. package/package.json +16 -11
  78. package/dist/chunk-6K3QWJHH.js.map +0 -1
  79. package/dist/chunk-6U3YPHXU.js.map +0 -1
  80. package/dist/chunk-D3BYGEQU.js.map +0 -1
  81. package/dist/chunk-RSMYGGQK.js.map +0 -1
  82. package/dist/chunk-SIE3E4FG.js.map +0 -1
  83. package/dist/chunk-TDWJ6WZA.js.map +0 -1
  84. package/dist/chunk-TLAVOBEM.js.map +0 -1
  85. package/dist/chunk-ZP6QQYSU.js +0 -7
  86. package/dist/chunk-ZP6QQYSU.js.map +0 -1
  87. package/dist/computed.types.d-gJrBeUMG.d.ts +0 -42
  88. /package/dist/{chunk-OQDBARD5.js.map → chunk-3HG5GIKR.js.map} +0 -0
  89. /package/dist/{chunk-RU6332MD.js.map → chunk-566LB3G2.js.map} +0 -0
  90. /package/dist/{chunk-MI7774NV.js.map → chunk-5BP2A7BI.js.map} +0 -0
  91. /package/dist/{chunk-GBZNFSFY.js.map → chunk-ADTCTKXS.js.map} +0 -0
  92. /package/dist/{chunk-FD4AB6TM.js.map → chunk-BBP7QV32.js.map} +0 -0
  93. /package/dist/{chunk-LFVPS7KB.js.map → chunk-CFTWXYBO.js.map} +0 -0
  94. /package/dist/{chunk-35WWWFS6.js.map → chunk-DAESCCLR.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { Q as QtiExpression } from './qti-expression.d-BPxEp8HU.js';
1
+ import { Q as QtiExpression } from './qti-expression.d-iH3w6mqf.js';
2
2
 
3
3
  declare abstract class QtiConditionExpression extends QtiExpression<boolean> {
4
4
  calculate(): Readonly<boolean>;
@@ -1,7 +1,8 @@
1
1
  import * as lit from 'lit';
2
2
  import { LitElement } from 'lit';
3
- import { b as ItemContext, V as VariableDeclaration, g as ResponseVariable, B as BaseType } from './item.types.d-B55QkJ92.js';
3
+ import { I as ItemContext } from './item.types.d-Zc6ZQDhu.js';
4
4
  import { a as QtiContextType, Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
5
+ import { V as VariableDeclaration, f as ResponseVariable, B as BaseType } from './variables.d-DWHlTszN.js';
5
6
 
6
7
  interface TestContext {
7
8
  items: (ItemContext & {
@@ -1,6 +1,6 @@
1
1
  import * as lit from 'lit';
2
2
  import { LitElement } from 'lit';
3
- import { a as Cardinality } from './item.types.d-B55QkJ92.js';
3
+ import { a as Cardinality } from './variables.d-DWHlTszN.js';
4
4
 
5
5
  declare abstract class QtiVariableDeclaration extends LitElement {
6
6
  render(): lit.TemplateResult<1>;
@@ -16,6 +16,13 @@ declare abstract class QtiFeedback extends LitElement {
16
16
  private get _context();
17
17
  private _computedContext?;
18
18
  checkShowFeedback(outcomeIdentifier: string): void;
19
+ /**
20
+ * Called when this feedback is about to show. Return `false` to keep it hidden: the host shows the
21
+ * content itself. The elements dispatch `qc-feedback-show` here.
22
+ */
23
+ protected feedbackShowing(): boolean;
24
+ /** Called when this feedback is about to hide. Return `false` to keep it showing: the host hides it itself. */
25
+ protected feedbackHiding(): boolean;
19
26
  }
20
27
 
21
28
  export { QtiFeedback as Q, QtiVariableDeclaration as a };
@@ -1,8 +1,9 @@
1
1
  import * as lit from 'lit';
2
2
  import { LitElement } from 'lit';
3
3
  import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
4
- import { C as ComputedItemContext, V as View } from './session.context.d-D5080LVx.js';
5
- import { C as ConfigContext } from './config.context.d-BvU9r-Mg.js';
4
+ import { C as ComputedItemContext, V as View } from './session.context.d-9gRdGK4T.js';
5
+ import { C as ConfigContext } from './config.context.d-Dm11aAuw.js';
6
+ import './public-events.d-3dGip9pd.js';
6
7
  import { QtiAssessmentItem } from './elements.js';
7
8
 
8
9
  /**
@@ -21,8 +21,8 @@ declare abstract class QtiRuleElement extends LitElement implements QtiRuleBase
21
21
  * every one of those loops without each of them having to report upwards.
22
22
  *
23
23
  * `qti-response-processing` catches it at the top of the run. The outcomes set
24
- * before the exit are kept, because each `qti-set-outcome-value` has already
25
- * dispatched by the time this is thrown.
24
+ * before the exit are kept: they are already on the run's working copy, which
25
+ * the item applies once the run ends.
26
26
  */
27
27
  declare class QtiExitResponseSignal extends Error {
28
28
  constructor();
@@ -0,0 +1,81 @@
1
+ import { C as ComputedContext, a as ComputedItem } from './computed.types.d-D06SAPP2.js';
2
+ import { a as QtiTestPluginState$1 } from './qti-test-state.d-CjvdranT.js';
3
+
4
+ /**
5
+ * A plugin's entry in the state, typed through `QtiTestPluginState`, or `undefined` before the
6
+ * plugin has stored anything. Read it from `computedContext`; write it by dispatching
7
+ * `qc-test-update-plugin-state` (`dispatchPublic`).
8
+ */
9
+ declare const pluginState: <K extends keyof QtiTestPluginState$1 & string>(context: Pick<ComputedContext, "plugins"> | undefined, plugin: K) => QtiTestPluginState$1[K] | undefined;
10
+
11
+ /**
12
+ * The items of a test part in the order the candidate takes them: the test's document order, info
13
+ * items included. Flattening `testPart.sections` is not that order when a section's item-refs and
14
+ * subsections interleave, since `sections` lists every section once, depth first.
15
+ *
16
+ * A part without `itemOrder` (a context built by hand) gives its sections' items as they are listed.
17
+ */
18
+ declare const itemsInOrder: (testPart: ComputedContext["testParts"][number]) => ComputedItem[];
19
+
20
+ /**
21
+ * Everything a host needs to persist to resume a candidate's test session, and nothing else.
22
+ *
23
+ * Read it from `qtiTest.state` or the `qc-test-state-changed` event, store it wherever you like —
24
+ * a database, `localStorage`, `sessionStorage` — and assign it back to `qtiTest.state` to resume.
25
+ *
26
+ * Deliberately not here:
27
+ * - declaration metadata (`baseType`, `cardinality`, `correctResponse`, `mapping`, …): it comes
28
+ * from the item XML on every load, and persisting the answer key with the candidate's data is
29
+ * both bloat and a leak;
30
+ * - `configContext` and `qtiContext`: inputs the host supplies on every load, not session state.
31
+ * The shuffle `seed` in particular must be passed in again, or the restored order changes;
32
+ * - `view`: a role the host decides, not something the candidate produced;
33
+ * - anything computed — scores per section, `done`, `active` — which is rederived from this.
34
+ */
35
+ interface QtiTestState {
36
+ /** Bumped on any incompatible change to this shape. A state with another version is ignored. */
37
+ version: 1;
38
+ test: {
39
+ items: QtiTestStateItem[];
40
+ /** Test-level outcome values. Only outcomes the test declares are restored. */
41
+ outcomes: QtiTestStateValue[];
42
+ };
43
+ session: QtiTestStateSession;
44
+ }
45
+ interface QtiTestStateItem {
46
+ /**
47
+ * The `qti-assessment-item-ref` identifier; for the clone of an item-ref that `qti-selection
48
+ * with-replacement="true"` selected again, its instance id: `item-3#2` (roadmap 1 T4).
49
+ */
50
+ identifier: string;
51
+ variables: (QtiTestStateValue & {
52
+ type?: 'response' | 'outcome' | 'template' | 'context';
53
+ })[];
54
+ /** Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`. */
55
+ state?: Record<string, string | null>;
56
+ }
57
+ interface QtiTestStateValue {
58
+ identifier: string;
59
+ value: string | string[] | null;
60
+ }
61
+ /**
62
+ * What each plugin keeps in the state, by plugin name. Empty here: a plugin adds its own entry by
63
+ * augmenting this interface (`declare module` on the module that declares it, with
64
+ * `interface QtiTestPluginState { bookmarks: string[] }`), and reads it with
65
+ * `pluginState(computedContext, 'bookmarks')`. The test never reads an entry; it
66
+ * stores and restores it, so a value must survive `JSON.stringify`.
67
+ */
68
+ interface QtiTestPluginState {
69
+ }
70
+ /** Where the candidate is, and what plugins keep. */
71
+ interface QtiTestStateSession {
72
+ /** Plugin entries by plugin name. Entries of plugins that are not loaded are kept as they are. */
73
+ plugins?: Partial<QtiTestPluginState> & Record<string, unknown>;
74
+ navPartId?: string | null;
75
+ navSectionId?: string | null;
76
+ /** The item on screen, as `items[].identifier` names it: a clone is `item-3#2`. */
77
+ navItemRefId?: string | null;
78
+ }
79
+ declare const QTI_TEST_STATE_VERSION = 1;
80
+
81
+ export { QTI_TEST_STATE_VERSION as Q, type QtiTestPluginState as a, type QtiTestState as b, type QtiTestStateItem as c, type QtiTestStateSession as d, type QtiTestStateValue as e, itemsInOrder as i, pluginState as p };
@@ -0,0 +1,61 @@
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 `qc-test-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
+ 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
+ interface QtiTestStateItem {
27
+ /**
28
+ * The `qti-assessment-item-ref` identifier; for the clone of an item-ref that `qti-selection
29
+ * with-replacement="true"` selected again, its instance id: `item-3#2` (roadmap 1 T4).
30
+ */
31
+ identifier: string;
32
+ variables: (QtiTestStateValue & {
33
+ type?: 'response' | 'outcome' | 'template' | 'context';
34
+ })[];
35
+ /** Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`. */
36
+ state?: Record<string, string | null>;
37
+ }
38
+ interface QtiTestStateValue {
39
+ identifier: string;
40
+ value: string | string[] | null;
41
+ }
42
+ /**
43
+ * What each plugin keeps in the state, by plugin name. Empty here: a plugin adds its own entry by
44
+ * augmenting this interface (`declare module` on the module that declares it, with
45
+ * `interface QtiTestPluginState { bookmarks: string[] }`), and reads it with
46
+ * `pluginState(computedContext, 'bookmarks')`. The test never reads an entry; it
47
+ * stores and restores it, so a value must survive `JSON.stringify`.
48
+ */
49
+ interface QtiTestPluginState {
50
+ }
51
+ /** Where the candidate is, and what plugins keep. */
52
+ interface QtiTestStateSession {
53
+ /** Plugin entries by plugin name. Entries of plugins that are not loaded are kept as they are. */
54
+ plugins?: Partial<QtiTestPluginState> & Record<string, unknown>;
55
+ navPartId?: string | null;
56
+ navSectionId?: string | null;
57
+ /** The item on screen, as `items[].identifier` names it: a clone is `item-3#2`. */
58
+ navItemRefId?: string | null;
59
+ }
60
+
61
+ export type { QtiTestState as Q, QtiTestPluginState as a };