@citolab/qti-components 10.0.0-next.21 → 10.0.0-next.23

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  QtiTest,
3
3
  TestNavigation
4
- } from "./chunk-TB2OI3ED.js";
4
+ } from "./chunk-IJKHXJSM.js";
5
5
  import {
6
6
  QtiAssessmentItem
7
7
  } from "./chunk-H6DO5UHC.js";
@@ -1686,4 +1686,4 @@ export {
1686
1686
  TestNavigationCorrection,
1687
1687
  QtiTestCorrection
1688
1688
  };
1689
- //# sourceMappingURL=chunk-55WWIRLN.js.map
1689
+ //# sourceMappingURL=chunk-ULJ22VKL.js.map
@@ -63,8 +63,6 @@ type ComputedContext = {
63
63
  completed?: boolean;
64
64
  /** This section's own item-refs, not those of its subsections; empty for a section that only holds sections. */
65
65
  items: ComputedItem[];
66
- navigationMode: 'linear' | 'nonlinear';
67
- submissionMode: 'individual' | 'simultaneous';
68
66
  allowSkipping?: boolean;
69
67
  }[];
70
68
  }[];
@@ -7,8 +7,8 @@ import { QtiAssessmentItem } from './elements.js';
7
7
  import { Q as QtiItem } from './qti-item.d-CxP6KtCH.js';
8
8
  import './public-events.d-3dGip9pd.js';
9
9
  import { V as View, C as ComputedItemContext } from './session.context.d-9gRdGK4T.js';
10
- import { l as QtiTest, r as TestNavigation } from './qti-test.d-DBT-YpRu.js';
11
- import { a as ComputedItem, C as ComputedContext } from './computed.types.d-6Ht-HNRx.js';
10
+ import { l as QtiTest, r as TestNavigation } from './qti-test.d-CN2JZwAz.js';
11
+ import { a as ComputedItem, C as ComputedContext } from './computed.types.d-6qQNFbu1.js';
12
12
  import './config.context.d-Dm11aAuw.js';
13
13
  import './interaction.interface.d-CvjHM2bi.js';
14
14
  import './variables.d-DWHlTszN.js';
@@ -33,10 +33,10 @@ import {
33
33
  TestNavigationCorrection,
34
34
  TestShowCorrectResponse,
35
35
  correctionPart
36
- } from "./chunk-55WWIRLN.js";
36
+ } from "./chunk-ULJ22VKL.js";
37
37
  import {
38
38
  qtiTestElements
39
- } from "./chunk-TB2OI3ED.js";
39
+ } from "./chunk-IJKHXJSM.js";
40
40
  import "./chunk-J6VX4N7M.js";
41
41
  import {
42
42
  qtiContentElements
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { I as ITestNavigationMixin, a as ITestStateMixin, b as ItemRefTemplateModel, Q as QtiAssessmentItemRef, c as QtiAssessmentSection, d as QtiAssessmentTest, e as QtiBranchRule, f as QtiItemSessionControl, g as QtiNumberPresented, h as QtiNumberSelected, i as QtiOutcomeProcessing, j as QtiOutcomeProcessingProcessor, k as QtiPreCondition, l as QtiTest, m as QtiTestFeedback, n as QtiTestPart, o as QtiTestVariables, p as QtiTestVariablesExpression, T as TestContainer, q as TestEndAttempt, r as TestNavigation, s as TestNext, t as TestPrev, u as TestSubmit } from './qti-test.d-DBT-YpRu.js';
2
- export { IMyQtiTest, IQtiTest, ITestProcessingMixin, pluginElements } from './test.js';
3
- export { Q as QTI_TEST_STATE_VERSION, a as QtiTestPluginState, b as QtiTestState, c as QtiTestStateItem, d as QtiTestStateSession, e as QtiTestStateValue, p as pluginState } from './qti-test-state-CF9S8X9C.js';
1
+ export { I as ITestNavigationMixin, a as ITestStateMixin, b as ItemRefTemplateModel, Q as QtiAssessmentItemRef, c as QtiAssessmentSection, d as QtiAssessmentTest, e as QtiBranchRule, f as QtiItemSessionControl, g as QtiNumberPresented, h as QtiNumberSelected, i as QtiOutcomeProcessing, j as QtiOutcomeProcessingProcessor, k as QtiPreCondition, l as QtiTest, m as QtiTestFeedback, n as QtiTestPart, o as QtiTestVariables, p as QtiTestVariablesExpression, T as TestContainer, q as TestEndAttempt, r as TestNavigation, s as TestNext, t as TestPrev, u as TestSubmit } from './qti-test.d-CN2JZwAz.js';
2
+ export { IMyQtiTest, IQtiTest, ITestProcessingMixin, StoredSessionContext, StoredTestContext, StoredVariable, pluginElements, stateFromContexts } from './test.js';
3
+ export { Q as QTI_TEST_STATE_VERSION, a as QtiTestPluginState, b as QtiTestState, c as QtiTestStateItem, d as QtiTestStateSession, e as QtiTestStateValue, p as pluginState } from './qti-test-state-C71K8UNC.js';
4
4
  export { I as ItemContainer, a as ItemPrintVariables, Q as QtiItem } from './qti-item.d-CxP6KtCH.js';
5
5
  export { ItemViewMixin } from './item.js';
6
6
  export { F as FeedbackEventDetail, P as PUBLIC_ITEM_EVENTS, a as PublicEventDeclaration, b as PublicItemEventMap, c as PublicItemEventName, R as RubricPlacement, d as dispatchDeclared, e as dispatchPublic, l as listenDeclared, f as listenPublic } from './public-events.d-3dGip9pd.js';
@@ -12,7 +12,7 @@ export { qtiTransformManifest } from './transformers.js';
12
12
  export { ManifestInfo, getItemByUri, getManifestInfo } from './loader.js';
13
13
  export { CustomOperator, CustomOperatorValue, CustomStateSetShim, CustomStateSupport, IsNullOrUndefined, STATE_ALIASES, ScoringHelper, boxSizing, classifyCustomStateSupport, computedContext, computedItemContext, convertNumberToUniversalFormat, decimalSeparator, dropRegion, getCustomOperator, hasState, installCustomStateSetFallback, itemContext, registerCustomOperator, removeDoubleSlashes, setState, unregisterCustomOperator, validationMessage } from './base.js';
14
14
  export { C as ComputedItemContext, I as INITIAL_SESSION_CONTEXT, S as SessionContext, V as View, s as sessionContext } from './session.context.d-9gRdGK4T.js';
15
- export { C as ComputedContext, a as ComputedItem, S as SessionControl } from './computed.types.d-6Ht-HNRx.js';
15
+ export { C as ComputedContext, a as ComputedItem, S as SessionControl } from './computed.types.d-6qQNFbu1.js';
16
16
  export { C as ConfigContext, V as ValidationDisplayMode, c as configContext } from './config.context.d-Dm11aAuw.js';
17
17
  export { C as ChoiceRole, I as Interaction, a as InteractionContext, R as RecordFieldValues, b as RecordValue, V as ValidityKind, c as ValidityTrigger, i as inferRecordFieldBaseType, d as interactionContext, e as isRecordValue, r as readRecordFieldValues } from './record.d-N1Bq7e1f.js';
18
18
  export { I as ItemContext, i as itemContextVariables } from './item.types.d-Zc6ZQDhu.js';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./chunk-JIDSFFFD.js";
1
+ import "./chunk-DJQE4M7B.js";
2
2
  import {
3
3
  pluginState
4
4
  } from "./chunk-DJ7PB252.js";
@@ -37,7 +37,7 @@ import {
37
37
  TestNavigationCorrection,
38
38
  TestShowCorrectResponse,
39
39
  correctionPart
40
- } from "./chunk-55WWIRLN.js";
40
+ } from "./chunk-ULJ22VKL.js";
41
41
  import {
42
42
  QTI_TEST_STATE_VERSION,
43
43
  QtiAssessmentItemRef,
@@ -61,8 +61,9 @@ import {
61
61
  TestNext,
62
62
  TestPrev,
63
63
  TestSubmit,
64
- pluginElements
65
- } from "./chunk-TB2OI3ED.js";
64
+ pluginElements,
65
+ stateFromContexts
66
+ } from "./chunk-IJKHXJSM.js";
66
67
  import "./chunk-J6VX4N7M.js";
67
68
  import "./chunk-TSJGL6FI.js";
68
69
  import {
@@ -531,6 +532,7 @@ export {
531
532
  serializeResponseAttribute,
532
533
  sessionContext,
533
534
  setState,
535
+ stateFromContexts,
534
536
  testContext,
535
537
  unregisterCustomOperator,
536
538
  validationMessage
@@ -4421,14 +4421,6 @@ export type QtiAssessmentSectionProps = {
4421
4421
  /** */
4422
4422
  keepTogether?: QtiAssessmentSection["keepTogether"] | undefined;
4423
4423
  /** */
4424
- "navigation-mode"?: QtiAssessmentSection["navigationMode"] | undefined;
4425
- /** */
4426
- navigationMode?: QtiAssessmentSection["navigationMode"] | undefined;
4427
- /** */
4428
- "submission-mode"?: QtiAssessmentSection["submissionMode"] | undefined;
4429
- /** */
4430
- submissionMode?: QtiAssessmentSection["submissionMode"] | undefined;
4431
- /** */
4432
4424
  title?: QtiAssessmentSection["title"] | undefined;
4433
4425
  /** */
4434
4426
  _testContext?: QtiAssessmentSection["_testContext"] | undefined;
@@ -4451,14 +4443,6 @@ export type QtiAssessmentSectionSolidJsProps = {
4451
4443
  /** */
4452
4444
  "prop:keepTogether"?: QtiAssessmentSection["keepTogether"] | undefined;
4453
4445
  /** */
4454
- "attr:navigation-mode"?: QtiAssessmentSection["navigationMode"] | undefined;
4455
- /** */
4456
- "prop:navigationMode"?: QtiAssessmentSection["navigationMode"] | undefined;
4457
- /** */
4458
- "attr:submission-mode"?: QtiAssessmentSection["submissionMode"] | undefined;
4459
- /** */
4460
- "prop:submissionMode"?: QtiAssessmentSection["submissionMode"] | undefined;
4461
- /** */
4462
4446
  "prop:title"?: QtiAssessmentSection["title"] | undefined;
4463
4447
  /** */
4464
4448
  "prop:_testContext"?: QtiAssessmentSection["_testContext"] | undefined;
@@ -9486,8 +9470,6 @@ export type CustomElements = {
9486
9470
  * - `fixed`: undefined
9487
9471
  * - `visible`: undefined
9488
9472
  * - `keep-together`/`keepTogether`: undefined
9489
- * - `navigation-mode`/`navigationMode`: undefined
9490
- * - `submission-mode`/`submissionMode`: undefined
9491
9473
  * - `title`: undefined (property only)
9492
9474
  * - `_testContext`: undefined (property only)
9493
9475
  *
@@ -15349,8 +15331,6 @@ export type CustomElementsSolidJs = {
15349
15331
  * - `fixed`: undefined
15350
15332
  * - `visible`: undefined
15351
15333
  * - `keep-together`/`keepTogether`: undefined
15352
- * - `navigation-mode`/`navigationMode`: undefined
15353
- * - `submission-mode`/`submissionMode`: undefined
15354
15334
  * - `title`: undefined (property only)
15355
15335
  * - `_testContext`: undefined (property only)
15356
15336
  *
@@ -1,4 +1,4 @@
1
- import { C as ComputedContext } from './computed.types.d-6Ht-HNRx.js';
1
+ import { C as ComputedContext } from './computed.types.d-6qQNFbu1.js';
2
2
  import { a as QtiTestPluginState$1 } from './qti-test-state.d-D8Q89RzZ.js';
3
3
 
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  import * as lit from 'lit';
2
2
  import { LitElement, PropertyValues } from 'lit';
3
3
  import { b as transformTestApi, t as transformItemApi } from './qti-transform-test.d-Bb9vnLzP.js';
4
- import { C as ComputedContext, a as ComputedItem } from './computed.types.d-6Ht-HNRx.js';
4
+ import { C as ComputedContext, a as ComputedItem } from './computed.types.d-6qQNFbu1.js';
5
5
  import './public-events.d-3dGip9pd.js';
6
6
  import { QtiAssessmentItem, QtiModalFeedback } from './elements.js';
7
7
  import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
@@ -119,8 +119,6 @@ declare class QtiAssessmentSection extends LitElement {
119
119
  set title(value: string);
120
120
  visible: boolean;
121
121
  keepTogether: boolean;
122
- navigationMode?: 'linear' | 'nonlinear';
123
- submissionMode?: 'individual' | 'simultaneous';
124
122
  _testContext?: TestContext;
125
123
  connectedCallback(): Promise<void>;
126
124
  render(): lit.TemplateResult<1>;
@@ -1,10 +1,10 @@
1
1
  import { V as View } from './session.context.d-9gRdGK4T.js';
2
2
  import { a as PublicEventDeclaration } from './public-events.d-3dGip9pd.js';
3
3
  import { Q as QtiTestState } from './qti-test-state.d-D8Q89RzZ.js';
4
- export { a as QtiTestPluginState, b as QtiTestState, p as pluginState } from './qti-test-state-CF9S8X9C.js';
4
+ export { a as QtiTestPluginState, b as QtiTestState, p as pluginState } from './qti-test-state-C71K8UNC.js';
5
5
  import * as lit from 'lit';
6
6
  import './variables.d-DWHlTszN.js';
7
- import './computed.types.d-6Ht-HNRx.js';
7
+ import './computed.types.d-6qQNFbu1.js';
8
8
 
9
9
  /**
10
10
  * The public events of the test. The name tells you it is public: everything here starts with
package/dist/test.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { u as TestSubmit, v as ItemVariableValue, I as ITestNavigationMixin, a as ITestStateMixin } from './qti-test.d-DBT-YpRu.js';
2
- export { b as ItemRefTemplateModel, Q as QtiAssessmentItemRef, c as QtiAssessmentSection, d as QtiAssessmentTest, e as QtiBranchRule, f as QtiItemSessionControl, g as QtiNumberPresented, h as QtiNumberSelected, i as QtiOutcomeProcessing, j as QtiOutcomeProcessingProcessor, k as QtiPreCondition, l as QtiTest, m as QtiTestFeedback, n as QtiTestPart, o as QtiTestVariables, p as QtiTestVariablesExpression, T as TestContainer, q as TestEndAttempt, r as TestNavigation, s as TestNext, t as TestPrev } from './qti-test.d-DBT-YpRu.js';
3
- export { Q as QTI_TEST_STATE_VERSION, a as QtiTestPluginState, b as QtiTestState, c as QtiTestStateItem, d as QtiTestStateSession, e as QtiTestStateValue, p as pluginState } from './qti-test-state-CF9S8X9C.js';
1
+ import { u as TestSubmit, v as ItemVariableValue, I as ITestNavigationMixin, a as ITestStateMixin } from './qti-test.d-CN2JZwAz.js';
2
+ export { b as ItemRefTemplateModel, Q as QtiAssessmentItemRef, c as QtiAssessmentSection, d as QtiAssessmentTest, e as QtiBranchRule, f as QtiItemSessionControl, g as QtiNumberPresented, h as QtiNumberSelected, i as QtiOutcomeProcessing, j as QtiOutcomeProcessingProcessor, k as QtiPreCondition, l as QtiTest, m as QtiTestFeedback, n as QtiTestPart, o as QtiTestVariables, p as QtiTestVariablesExpression, T as TestContainer, q as TestEndAttempt, r as TestNavigation, s as TestNext, t as TestPrev } from './qti-test.d-CN2JZwAz.js';
3
+ import { b as QtiTestState } from './qti-test-state-C71K8UNC.js';
4
+ export { Q as QTI_TEST_STATE_VERSION, a as QtiTestPluginState, c as QtiTestStateItem, d as QtiTestStateSession, e as QtiTestStateValue, p as pluginState } from './qti-test-state-C71K8UNC.js';
4
5
  import { LitElement } from 'lit';
5
6
  import { b as OutcomeVariable, V as VariableDeclaration } from './variables.d-DWHlTszN.js';
6
7
  import { S as SessionContext } from './session.context.d-9gRdGK4T.js';
@@ -8,7 +9,7 @@ import { C as ConfigContext } from './config.context.d-Dm11aAuw.js';
8
9
  import { I as ItemContext } from './item.types.d-Zc6ZQDhu.js';
9
10
  import { T as TestContext } from './qti-expression.d-iH3w6mqf.js';
10
11
  import './qti-transform-test.d-Bb9vnLzP.js';
11
- import './computed.types.d-6Ht-HNRx.js';
12
+ import './computed.types.d-6qQNFbu1.js';
12
13
  import './public-events.d-3dGip9pd.js';
13
14
  import './elements.js';
14
15
  import './interaction.interface.d-CvjHM2bi.js';
@@ -29,6 +30,51 @@ declare const pluginElements: readonly [{
29
30
  readonly ctor: typeof TestSubmit;
30
31
  }];
31
32
 
33
+ /** A value as a 9.x host may have stored it: QTI values are strings, but JSON kept numbers as numbers. */
34
+ type StoredValue = string | number | boolean | null | undefined | readonly (string | number | boolean)[];
35
+ /** A variable as stored: only `identifier`, `value` and `type` are read; declaration metadata is ignored. */
36
+ interface StoredVariable {
37
+ identifier: string;
38
+ value?: StoredValue;
39
+ type?: string;
40
+ }
41
+ /**
42
+ * A `testContext` as a 9.x host stored it (`qtiTest.testContext` or the `qti-test-context-updated`
43
+ * payload), plain JSON. Fields this does not name, such as an item's `href` or a host's own
44
+ * additions, are ignored.
45
+ */
46
+ interface StoredTestContext {
47
+ items?: readonly {
48
+ identifier?: string;
49
+ variables?: readonly StoredVariable[];
50
+ state?: Readonly<Record<string, string | null>>;
51
+ }[];
52
+ testOutcomeVariables?: readonly StoredVariable[];
53
+ }
54
+ /** A `sessionContext` as a 9.x host stored it: the position and the plugin entries. */
55
+ interface StoredSessionContext {
56
+ navPartId?: string | null;
57
+ navSectionId?: string | null;
58
+ navItemRefId?: string | null;
59
+ plugins?: Readonly<Record<string, unknown>>;
60
+ }
61
+ /**
62
+ * Turns a stored `testContext` and `sessionContext` into a `QtiTestState`, so a host that stored the
63
+ * contexts in 9.x can resume with `qtiTest.state = stateFromContexts(testContext, sessionContext)`.
64
+ * `qtiTest.state` reads the same way from the live contexts.
65
+ *
66
+ * It keeps the values only: each item's variables (identifier, value and `type` when it is one QTI
67
+ * knows) and per-interaction state, the test outcomes, the position and the plugin entries. Values
68
+ * are written as QTI's strings, so a number a host stored as a JSON number (`SCORE: 0`) becomes
69
+ * `'0'`. Declaration metadata (`baseType`, `cardinality`, `correctResponse`, …) is left out, as in
70
+ * every `QtiTestState`. Items without an identifier are skipped.
71
+ *
72
+ * @param testContext The stored test context, plain JSON.
73
+ * @param sessionContext The stored session context, if the host kept one. A host that stored only the
74
+ * item it was on passes `{ navItemRefId }`.
75
+ */
76
+ declare const stateFromContexts: (testContext: Readonly<StoredTestContext> | null | undefined, sessionContext?: Readonly<StoredSessionContext> | null) => QtiTestState;
77
+
32
78
  interface IQtiTest extends LitElement, ITestNavigationMixin, ITestProcessingMixin, ITestStateMixin, IMyQtiTest {
33
79
  }
34
80
  interface IMyQtiTest {
@@ -45,4 +91,4 @@ interface ITestProcessingMixin {
45
91
  outcomeProcessing(): boolean;
46
92
  }
47
93
 
48
- export { type IMyQtiTest, type IQtiTest, ITestNavigationMixin, type ITestProcessingMixin, ITestStateMixin, TestSubmit, pluginElements };
94
+ export { type IMyQtiTest, type IQtiTest, ITestNavigationMixin, type ITestProcessingMixin, ITestStateMixin, QtiTestState, type StoredSessionContext, type StoredTestContext, type StoredVariable, TestSubmit, pluginElements, stateFromContexts };
package/dist/test.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./chunk-JIDSFFFD.js";
1
+ import "./chunk-DJQE4M7B.js";
2
2
  import {
3
3
  pluginState
4
4
  } from "./chunk-DJ7PB252.js";
@@ -25,8 +25,9 @@ import {
25
25
  TestNext,
26
26
  TestPrev,
27
27
  TestSubmit,
28
- pluginElements
29
- } from "./chunk-TB2OI3ED.js";
28
+ pluginElements,
29
+ stateFromContexts
30
+ } from "./chunk-IJKHXJSM.js";
30
31
  import "./chunk-J6VX4N7M.js";
31
32
  import "./chunk-H6DO5UHC.js";
32
33
  import "./chunk-UCXLDQYA.js";
@@ -59,6 +60,7 @@ export {
59
60
  TestPrev,
60
61
  TestSubmit,
61
62
  pluginElements,
62
- pluginState
63
+ pluginState,
64
+ stateFromContexts
63
65
  };
64
66
  //# sourceMappingURL=test.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@citolab/qti-components",
3
3
  "description": "QTI component utilities",
4
- "version": "10.0.0-next.21",
4
+ "version": "10.0.0-next.23",
5
5
  "author": "",
6
6
  "dependencies": {
7
7
  "@heximal/templates": "^0.1.5",
@@ -10,7 +10,7 @@
10
10
  "lit-html": "^3.3.1"
11
11
  },
12
12
  "devDependencies": {
13
- "@qti-components/base": "^3.0.0-next.8",
13
+ "@qti-components/base": "^3.0.0-next.9",
14
14
  "@qti-components/corrections": "^1.0.0-next.11",
15
15
  "@qti-components/delivery": "^0.1.0-next.1",
16
16
  "@qti-components/elements": "^2.0.0-next.7",
@@ -18,7 +18,7 @@
18
18
  "@qti-components/item": "^1.5.1-next.7",
19
19
  "@qti-components/loader": "^1.3.4-next.2",
20
20
  "@qti-components/processing": "^1.6.1-next.5",
21
- "@qti-components/test": "^2.0.0-next.17",
21
+ "@qti-components/test": "^2.0.0-next.19",
22
22
  "@qti-components/theme": "^3.0.0-next.6",
23
23
  "@qti-components/transformers": "^1.8.0-next.1"
24
24
  },