@citolab/qti-components 10.0.0-next.2 → 10.0.0-next.20
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.
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +4334 -2688
- package/dist/base.d.ts +39 -13
- package/dist/base.js +14 -1
- package/dist/{chunk-RU6332MD.js → chunk-2A52V5TQ.js} +4 -4
- package/dist/{chunk-MI7774NV.js → chunk-5BP2A7BI.js} +2 -2
- package/dist/{chunk-35WWWFS6.js → chunk-DAESCCLR.js} +2 -2
- package/dist/chunk-DJ7PB252.js +7 -0
- package/dist/chunk-DJ7PB252.js.map +1 -0
- package/dist/{chunk-3ZNECUPV.js → chunk-GJWA6LLT.js} +2 -2
- package/dist/{chunk-TDWJ6WZA.js → chunk-GPC53O7P.js} +166 -10
- package/dist/chunk-GPC53O7P.js.map +1 -0
- package/dist/{chunk-6U3YPHXU.js → chunk-H6DO5UHC.js} +277 -154
- package/dist/chunk-H6DO5UHC.js.map +1 -0
- package/dist/chunk-J6VX4N7M.js +197 -0
- package/dist/chunk-J6VX4N7M.js.map +1 -0
- package/dist/{chunk-FD4AB6TM.js → chunk-KQ2LED4X.js} +2 -2
- package/dist/{chunk-6K3QWJHH.js → chunk-LPYZVKHX.js} +48 -7
- package/dist/chunk-LPYZVKHX.js.map +1 -0
- package/dist/{chunk-K3VKQ6QF.js → chunk-ORQFZNJW.js} +614 -1847
- package/dist/chunk-ORQFZNJW.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/{chunk-GBZNFSFY.js → chunk-TSJGL6FI.js} +2 -2
- package/dist/{chunk-RSMYGGQK.js → chunk-TZCOXFPB.js} +1590 -610
- package/dist/chunk-TZCOXFPB.js.map +1 -0
- package/dist/chunk-UCXLDQYA.js +56 -0
- package/dist/chunk-UCXLDQYA.js.map +1 -0
- package/dist/chunk-WWY2H2YO.js +7 -0
- package/dist/chunk-WWY2H2YO.js.map +1 -0
- package/dist/{chunk-LFVPS7KB.js → chunk-XWRZP2RM.js} +2 -2
- package/dist/{chunk-2KP5UU5A.js → chunk-Y6Q3F2S7.js} +117 -92
- package/dist/chunk-Y6Q3F2S7.js.map +1 -0
- package/dist/{chunk-TLAVOBEM.js → chunk-ZRORBAHB.js} +122 -3
- package/dist/chunk-ZRORBAHB.js.map +1 -0
- package/dist/computed.types.d-6Ht-HNRx.d.ts +80 -0
- package/dist/{config.context.d-BvU9r-Mg.d.ts → config.context.d-Dm11aAuw.d.ts} +21 -3
- package/dist/corrections.d.ts +137 -24
- package/dist/corrections.js +12 -12
- package/dist/corrections.js.map +1 -1
- package/dist/elements.d.ts +66 -73
- package/dist/elements.js +9 -6
- package/dist/index.d.ts +21 -17
- package/dist/index.js +47 -61
- package/dist/interactions.d.ts +98 -19
- package/dist/interactions.js +8 -3
- package/dist/item.css +1948 -1946
- package/dist/item.d.ts +8 -6
- package/dist/item.js +6 -5
- package/dist/item.types.d-Zc6ZQDhu.d.ts +25 -0
- package/dist/loader.d.ts +5 -3
- package/dist/loader.js +3 -2
- package/dist/processing.d.ts +19 -7
- package/dist/processing.js +4 -3
- package/dist/public-events.d-3dGip9pd.d.ts +105 -0
- package/dist/qti-components-jsx.d.ts +1780 -1727
- package/dist/{qti-condition-expression.d-VJH6cWxf.d.ts → qti-condition-expression.d-7Kd4LBxn.d.ts} +1 -1
- package/dist/{qti-expression.d-BPxEp8HU.d.ts → qti-expression.d-iH3w6mqf.d.ts} +2 -1
- package/dist/{qti-feedback.d-wMYNVkkj.d.ts → qti-feedback.d-CT0W-8Gm.d.ts} +8 -1
- package/dist/{qti-item.d-DgC1AQbY.d.ts → qti-item.d-CxP6KtCH.d.ts} +3 -2
- package/dist/{qti-rule-base.d-Bdzg8eGH.d.ts → qti-rule-base.d-CeKP0Ooi.d.ts} +2 -2
- package/dist/qti-test-state-CF9S8X9C.d.ts +68 -0
- package/dist/qti-test-state.d-D8Q89RzZ.d.ts +57 -0
- package/dist/{qti-test.d-DkpBNcsv.d.ts → qti-test.d-sskv-dEN.d.ts} +87 -485
- package/dist/{qti-text-entry-interaction.d-q8u5BiVK.d.ts → qti-text-entry-interaction.d-m0EFv9no.d.ts} +221 -73
- package/dist/{qti-transform-test.d-BL7GGFJj.d.ts → qti-transform-test.d-Bb9vnLzP.d.ts} +1 -0
- package/dist/{interaction.d-g6XG0T0Z.d.ts → record.d-N1Bq7e1f.d.ts} +67 -4
- package/dist/{session.context.d-D5080LVx.d.ts → session.context.d-9gRdGK4T.d.ts} +7 -1
- package/dist/test-plugin-api.d.ts +134 -0
- package/dist/test-plugin-api.js +19 -0
- package/dist/test-plugin-api.js.map +1 -0
- package/dist/test.d.ts +26 -57
- package/dist/test.js +19 -48
- package/dist/transformers.d.ts +1 -1
- package/dist/transformers.js +2 -1
- package/dist/{item.types.d-B55QkJ92.d.ts → variables.d-DWHlTszN.d.ts} +8 -24
- package/package.json +16 -11
- package/dist/chunk-2KP5UU5A.js.map +0 -1
- package/dist/chunk-6K3QWJHH.js.map +0 -1
- package/dist/chunk-6U3YPHXU.js.map +0 -1
- package/dist/chunk-K3VKQ6QF.js.map +0 -1
- package/dist/chunk-RSMYGGQK.js.map +0 -1
- package/dist/chunk-TDWJ6WZA.js.map +0 -1
- package/dist/chunk-TLAVOBEM.js.map +0 -1
- package/dist/chunk-ZP6QQYSU.js +0 -7
- package/dist/chunk-ZP6QQYSU.js.map +0 -1
- package/dist/computed.types.d-gJrBeUMG.d.ts +0 -42
- /package/dist/{chunk-RU6332MD.js.map → chunk-2A52V5TQ.js.map} +0 -0
- /package/dist/{chunk-MI7774NV.js.map → chunk-5BP2A7BI.js.map} +0 -0
- /package/dist/{chunk-35WWWFS6.js.map → chunk-DAESCCLR.js.map} +0 -0
- /package/dist/{chunk-3ZNECUPV.js.map → chunk-GJWA6LLT.js.map} +0 -0
- /package/dist/{chunk-FD4AB6TM.js.map → chunk-KQ2LED4X.js.map} +0 -0
- /package/dist/{chunk-GBZNFSFY.js.map → chunk-TSJGL6FI.js.map} +0 -0
- /package/dist/{chunk-LFVPS7KB.js.map → chunk-XWRZP2RM.js.map} +0 -0
package/dist/base.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { C as ComputedItemContext } from './session.context.d-
|
|
2
|
-
export { I as INITIAL_SESSION_CONTEXT, S as SessionContext, V as View, s as sessionContext } from './session.context.d-
|
|
3
|
-
import { C as ComputedContext } from './computed.types.d-
|
|
4
|
-
export { a as ComputedItem } from './computed.types.d-
|
|
5
|
-
export { C as ConfigContext, V as ValidationDisplayMode, c as configContext } from './config.context.d-
|
|
6
|
-
export { C as ChoiceRole, I as Interaction, a as InteractionContext, i as interactionContext } from './
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
1
|
+
import { C as ComputedItemContext } from './session.context.d-9gRdGK4T.js';
|
|
2
|
+
export { I as INITIAL_SESSION_CONTEXT, S as SessionContext, V as View, s as sessionContext } from './session.context.d-9gRdGK4T.js';
|
|
3
|
+
import { C as ComputedContext } from './computed.types.d-6Ht-HNRx.js';
|
|
4
|
+
export { a as ComputedItem, S as SessionControl } from './computed.types.d-6Ht-HNRx.js';
|
|
5
|
+
export { C as ConfigContext, V as ValidationDisplayMode, c as configContext } from './config.context.d-Dm11aAuw.js';
|
|
6
|
+
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';
|
|
7
|
+
import { I as ItemContext } from './item.types.d-Zc6ZQDhu.js';
|
|
8
|
+
export { i as itemContextVariables } from './item.types.d-Zc6ZQDhu.js';
|
|
9
9
|
export { Q as QtiContext, a as QtiContextType, S as Seed, b as asSeed, i as isSeed, q as qtiContext } from './qti.context.d-CejJMlfZ.js';
|
|
10
|
-
export { I as INITIAL_TEST_CONTEXT, Q as QtiExpression, a as QtiExpressionBase, T as TestContext, t as testContext } from './qti-expression.d-
|
|
10
|
+
export { I as INITIAL_TEST_CONTEXT, Q as QtiExpression, a as QtiExpressionBase, T as TestContext, t as testContext } from './qti-expression.d-iH3w6mqf.js';
|
|
11
11
|
import * as lit from 'lit';
|
|
12
|
-
export { Q as QtiFeedback, a as QtiVariableDeclaration } from './qti-feedback.d-
|
|
13
|
-
export { Q as QtiConditionExpression } from './qti-condition-expression.d-
|
|
12
|
+
export { Q as QtiFeedback, a as QtiVariableDeclaration } from './qti-feedback.d-CT0W-8Gm.js';
|
|
13
|
+
export { Q as QtiConditionExpression } from './qti-condition-expression.d-7Kd4LBxn.js';
|
|
14
14
|
export { D as DirectedPair, I as Identifier, P as Point, R as ResponseValue, i as iterResponseValues, p as parsePair, a as parsePoint, b as parseResponseAttribute, r as responseAttributeConverter, s as serializePair, c as serializePoint, d as serializeResponseAttribute } from './response.d-_8y4kjGP.js';
|
|
15
|
+
import { B as BaseType } from './variables.d-DWHlTszN.js';
|
|
16
|
+
export { C as Calculate, a as Cardinality, I as InterpolationTableEntry, M as Multiple, O as Ordered, b as OutcomeVariable, Q as QtiAreaMapEntry, c as QtiAreaMapping, d as QtiMapEntry, e as QtiMapping, R as ResponseInteraction, f as ResponseVariable, T as TemplateVariable, V as VariableDeclaration, g as VariableValue, h as areaShape, i as directedPair, j as float, k as integer } from './variables.d-DWHlTszN.js';
|
|
15
17
|
export { F as FormAssociatedInteraction, I as IInteraction, R as ReadonlyInteraction, a as RegisteredInteraction, b as ResettableInteraction, c as ResponseIdentifiedInteraction, d as ResponseInteractionElement, V as ValidatableInteraction } from './interaction.interface.d-CvjHM2bi.js';
|
|
16
|
-
export { Q as QtiExitResponseSignal, a as QtiExitTestSignal, b as QtiRuleBase, c as QtiRuleElement } from './qti-rule-base.d-
|
|
18
|
+
export { Q as QtiExitResponseSignal, a as QtiExitTestSignal, b as QtiRuleBase, c as QtiRuleElement } from './qti-rule-base.d-CeKP0Ooi.js';
|
|
17
19
|
|
|
18
20
|
declare const computedItemContext: {
|
|
19
21
|
__context__: Readonly<ComputedItemContext>;
|
|
@@ -192,6 +194,30 @@ declare function classifyCustomStateSupport(attachInternals: (this: HTMLElement)
|
|
|
192
194
|
*/
|
|
193
195
|
declare function installCustomStateSetFallback(): CustomStateSupport | 'already-installed';
|
|
194
196
|
|
|
197
|
+
/**
|
|
198
|
+
* The vocabulary of custom states (CONTRACT.md §3 in qti-theme), with the names it replaced.
|
|
199
|
+
*
|
|
200
|
+
* A state is set under the name the contract uses. For one major the old name is set too, so a
|
|
201
|
+
* host that still reads `:state(drag)` keeps working while the theme reads `:state(chip)`. When the
|
|
202
|
+
* alias period ends, empty the table; every call site then sets only the new name.
|
|
203
|
+
*
|
|
204
|
+
* Not in the table, because the old name meant something else on another element:
|
|
205
|
+
* - a drop target's `drag-active` replaced `active` + `enabled`; the interaction host's `drag-active`
|
|
206
|
+
* replaced `dragzone-active` + `dragzone-enabled`. Each call site names its own old pair.
|
|
207
|
+
* - a drop target's `full` replaced the attribute `disabled`, which stays as an attribute.
|
|
208
|
+
* - `answer-key` replaced `show-correct-response` on an interaction host and `correct-response` on a
|
|
209
|
+
* choice; the corrections package passes the one that applies.
|
|
210
|
+
*/
|
|
211
|
+
declare const STATE_ALIASES: Readonly<Record<string, readonly string[]>>;
|
|
212
|
+
type StateSet = Pick<Set<string>, 'add' | 'delete' | 'has'>;
|
|
213
|
+
/**
|
|
214
|
+
* Set or clear a state and its aliases. `states` may be undefined on an element without internals;
|
|
215
|
+
* then nothing happens, as before.
|
|
216
|
+
*/
|
|
217
|
+
declare function setState(states: StateSet | undefined | null, name: string, on: boolean, oldNames?: readonly string[]): void;
|
|
218
|
+
/** Whether a state is set, under its contract name or an alias. */
|
|
219
|
+
declare function hasState(states: StateSet | undefined | null, name: string): boolean;
|
|
220
|
+
|
|
195
221
|
declare class ScoringHelper {
|
|
196
222
|
/**
|
|
197
223
|
* Checks if a given point is within a specified area.
|
|
@@ -232,4 +258,4 @@ declare const convertNumberToUniversalFormat: (number: number | string) => strin
|
|
|
232
258
|
declare function IsNullOrUndefined(value: unknown): boolean;
|
|
233
259
|
declare function removeDoubleSlashes(str: string): string;
|
|
234
260
|
|
|
235
|
-
export { BaseType, ComputedContext, ComputedItemContext, type CustomOperator, type CustomOperatorValue, CustomStateSetShim, type CustomStateSupport, IsNullOrUndefined, ItemContext, ScoringHelper, boxSizing, classifyCustomStateSupport, computedContext, computedItemContext, convertNumberToUniversalFormat, decimalSeparator, dropRegion, getCustomOperator, installCustomStateSetFallback, itemContext, registerCustomOperator, removeDoubleSlashes, unregisterCustomOperator, validationMessage };
|
|
261
|
+
export { BaseType, ComputedContext, ComputedItemContext, type CustomOperator, type CustomOperatorValue, CustomStateSetShim, type CustomStateSupport, IsNullOrUndefined, ItemContext, STATE_ALIASES, ScoringHelper, boxSizing, classifyCustomStateSupport, computedContext, computedItemContext, convertNumberToUniversalFormat, decimalSeparator, dropRegion, getCustomOperator, hasState, installCustomStateSetFallback, itemContext, registerCustomOperator, removeDoubleSlashes, setState, unregisterCustomOperator, validationMessage };
|
package/dist/base.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
QtiFeedback,
|
|
12
12
|
QtiRuleElement,
|
|
13
13
|
QtiVariableDeclaration,
|
|
14
|
+
STATE_ALIASES,
|
|
14
15
|
ScoringHelper,
|
|
15
16
|
asSeed,
|
|
16
17
|
boxSizing,
|
|
@@ -22,8 +23,11 @@ import {
|
|
|
22
23
|
decimalSeparator,
|
|
23
24
|
dropRegion,
|
|
24
25
|
getCustomOperator,
|
|
26
|
+
hasState,
|
|
27
|
+
inferRecordFieldBaseType,
|
|
25
28
|
installCustomStateSetFallback,
|
|
26
29
|
interactionContext,
|
|
30
|
+
isRecordValue,
|
|
27
31
|
isSeed,
|
|
28
32
|
itemContext,
|
|
29
33
|
itemContextVariables,
|
|
@@ -32,6 +36,7 @@ import {
|
|
|
32
36
|
parsePoint,
|
|
33
37
|
parseResponseAttribute,
|
|
34
38
|
qtiContext,
|
|
39
|
+
readRecordFieldValues,
|
|
35
40
|
registerCustomOperator,
|
|
36
41
|
removeDoubleSlashes,
|
|
37
42
|
responseAttributeConverter,
|
|
@@ -39,10 +44,12 @@ import {
|
|
|
39
44
|
serializePoint,
|
|
40
45
|
serializeResponseAttribute,
|
|
41
46
|
sessionContext,
|
|
47
|
+
setState,
|
|
42
48
|
testContext,
|
|
43
49
|
unregisterCustomOperator,
|
|
44
50
|
validationMessage
|
|
45
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-GPC53O7P.js";
|
|
52
|
+
import "./chunk-PZ5AY32C.js";
|
|
46
53
|
export {
|
|
47
54
|
CustomStateSetShim,
|
|
48
55
|
INITIAL_SESSION_CONTEXT,
|
|
@@ -56,6 +63,7 @@ export {
|
|
|
56
63
|
QtiFeedback,
|
|
57
64
|
QtiRuleElement,
|
|
58
65
|
QtiVariableDeclaration,
|
|
66
|
+
STATE_ALIASES,
|
|
59
67
|
ScoringHelper,
|
|
60
68
|
asSeed,
|
|
61
69
|
boxSizing,
|
|
@@ -67,8 +75,11 @@ export {
|
|
|
67
75
|
decimalSeparator,
|
|
68
76
|
dropRegion,
|
|
69
77
|
getCustomOperator,
|
|
78
|
+
hasState,
|
|
79
|
+
inferRecordFieldBaseType,
|
|
70
80
|
installCustomStateSetFallback,
|
|
71
81
|
interactionContext,
|
|
82
|
+
isRecordValue,
|
|
72
83
|
isSeed,
|
|
73
84
|
itemContext,
|
|
74
85
|
itemContextVariables,
|
|
@@ -77,6 +88,7 @@ export {
|
|
|
77
88
|
parsePoint,
|
|
78
89
|
parseResponseAttribute,
|
|
79
90
|
qtiContext,
|
|
91
|
+
readRecordFieldValues,
|
|
80
92
|
registerCustomOperator,
|
|
81
93
|
removeDoubleSlashes,
|
|
82
94
|
responseAttributeConverter,
|
|
@@ -84,6 +96,7 @@ export {
|
|
|
84
96
|
serializePoint,
|
|
85
97
|
serializeResponseAttribute,
|
|
86
98
|
sessionContext,
|
|
99
|
+
setState,
|
|
87
100
|
testContext,
|
|
88
101
|
unregisterCustomOperator,
|
|
89
102
|
validationMessage
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
item_css_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WWY2H2YO.js";
|
|
4
4
|
import {
|
|
5
5
|
watch
|
|
6
6
|
} from "./chunk-4DB4SC5K.js";
|
|
7
7
|
import {
|
|
8
8
|
qtiTransformItem
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZRORBAHB.js";
|
|
10
10
|
import {
|
|
11
11
|
computedItemContext,
|
|
12
12
|
configContext,
|
|
13
13
|
qtiContext
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GPC53O7P.js";
|
|
15
15
|
|
|
16
16
|
// ../qti-item/dist/components/item-container/item-container.js
|
|
17
17
|
import { consume } from "@lit/context";
|
|
@@ -349,4 +349,4 @@ export {
|
|
|
349
349
|
QtiItem,
|
|
350
350
|
qtiItemElements
|
|
351
351
|
};
|
|
352
|
-
//# sourceMappingURL=chunk-
|
|
352
|
+
//# sourceMappingURL=chunk-2A52V5TQ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
qtiProcessingElements
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LPYZVKHX.js";
|
|
4
4
|
|
|
5
5
|
// ../qti-processing/dist/register.js
|
|
6
6
|
for (const { tag, ctor } of qtiProcessingElements) {
|
|
@@ -8,4 +8,4 @@ for (const { tag, ctor } of qtiProcessingElements) {
|
|
|
8
8
|
customElements.define(tag, ctor);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-5BP2A7BI.js.map
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
elements8,
|
|
22
22
|
elements9,
|
|
23
23
|
qtiInteractionElements
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-TZCOXFPB.js";
|
|
25
25
|
|
|
26
26
|
// ../qti-interactions/dist/register-all.js
|
|
27
27
|
for (const { tag, ctor } of qtiInteractionElements) {
|
|
@@ -176,4 +176,4 @@ for (const { tag, ctor } of elements21) {
|
|
|
176
176
|
customElements.define(tag, ctor);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
//# sourceMappingURL=chunk-
|
|
179
|
+
//# sourceMappingURL=chunk-DAESCCLR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../qti-test/src/plugin-state.ts"],"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 * `qc-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"],"mappings":";AAQO,IAAM,cAAc,CACzB,SACA,WACsC,SAAS,UAAU,MAAM;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
qtiTestElements
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ORQFZNJW.js";
|
|
4
4
|
|
|
5
5
|
// ../qti-test/dist/register.js
|
|
6
6
|
for (const { tag, ctor } of qtiTestElements) {
|
|
@@ -8,4 +8,4 @@ for (const { tag, ctor } of qtiTestElements) {
|
|
|
8
8
|
customElements.define(tag, ctor);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-GJWA6LLT.js.map
|
|
@@ -106,7 +106,8 @@ var itemContextVariables = [
|
|
|
106
106
|
identifier: "completionStatus",
|
|
107
107
|
cardinality: "single",
|
|
108
108
|
baseType: "string",
|
|
109
|
-
|
|
109
|
+
// QTI info model §2.2.2; the item makes it `unknown` once it is presented.
|
|
110
|
+
value: "not_attempted",
|
|
110
111
|
type: "outcome"
|
|
111
112
|
},
|
|
112
113
|
{
|
|
@@ -201,6 +202,35 @@ var validationMessage = css3`
|
|
|
201
202
|
}
|
|
202
203
|
`;
|
|
203
204
|
|
|
205
|
+
// ../qti-base/dist/utils/state-aliases.js
|
|
206
|
+
var STATE_ALIASES = {
|
|
207
|
+
chip: ["drag"],
|
|
208
|
+
drop: ["droppable"],
|
|
209
|
+
lifted: ["dragging"],
|
|
210
|
+
used: ["placeholder"],
|
|
211
|
+
"return-target": ["return-anchor"],
|
|
212
|
+
"drag-over": ["hover"],
|
|
213
|
+
"candidate-partial": ["candidate-partially-correct"]
|
|
214
|
+
};
|
|
215
|
+
function setState(states, name, on, oldNames) {
|
|
216
|
+
if (!states)
|
|
217
|
+
return;
|
|
218
|
+
const names = [name, ...oldNames ?? STATE_ALIASES[name] ?? []];
|
|
219
|
+
for (const n of names) {
|
|
220
|
+
if (on)
|
|
221
|
+
states.add(n);
|
|
222
|
+
else
|
|
223
|
+
states.delete(n);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function hasState(states, name) {
|
|
227
|
+
if (!states)
|
|
228
|
+
return false;
|
|
229
|
+
if (states.has(name))
|
|
230
|
+
return true;
|
|
231
|
+
return (STATE_ALIASES[name] ?? []).some((n) => states.has(n));
|
|
232
|
+
}
|
|
233
|
+
|
|
204
234
|
// ../qti-base/dist/abstract/interaction.js
|
|
205
235
|
import { ContextConsumer, consume, provide } from "@lit/context";
|
|
206
236
|
import { LitElement } from "lit";
|
|
@@ -320,11 +350,40 @@ var Interaction = class extends LitElement {
|
|
|
320
350
|
set value(val) {
|
|
321
351
|
this.response = val ? JSON.parse(val) : null;
|
|
322
352
|
}
|
|
323
|
-
|
|
353
|
+
/** Forget that a submit has reported: a reset or a new attempt waits for a submit again. */
|
|
354
|
+
resetValidityReport() {
|
|
355
|
+
this._validityReported = false;
|
|
356
|
+
this.clearInlineValidationMessage();
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Show the validity state, in the configured mode.
|
|
360
|
+
*
|
|
361
|
+
* When it shows depends on what asked: a `change` (the candidate picked or dropped something)
|
|
362
|
+
* reports what they just did wrong, too many, at once; too few is not an error until they say they
|
|
363
|
+
* are done, so a `submit` (the item's end attempt, a form's submit) is what first shows it. After
|
|
364
|
+
* that first submit, changes report in full, so the message clears the moment the minimum is met
|
|
365
|
+
* and comes back if it is lost again. The validity itself is always set: a form with a
|
|
366
|
+
* below-minimum interaction cannot submit either way.
|
|
367
|
+
*/
|
|
368
|
+
reportValidity(options) {
|
|
369
|
+
const trigger = options?.trigger ?? "submit";
|
|
370
|
+
if (trigger === "submit")
|
|
371
|
+
this.validate?.();
|
|
324
372
|
const isValid = this._internals.validity.valid;
|
|
325
373
|
const mode = this.validationDisplayMode;
|
|
374
|
+
if (trigger === "submit")
|
|
375
|
+
this._validityReported = true;
|
|
376
|
+
if (trigger === "change" && !this._validityReported && this._validityKind === "min") {
|
|
377
|
+
this.clearInlineValidationMessage();
|
|
378
|
+
return isValid;
|
|
379
|
+
}
|
|
326
380
|
if (mode === "native" || mode === "both") {
|
|
327
|
-
this.
|
|
381
|
+
this._reportingNatively = true;
|
|
382
|
+
try {
|
|
383
|
+
this._internals.reportValidity();
|
|
384
|
+
} finally {
|
|
385
|
+
this._reportingNatively = false;
|
|
386
|
+
}
|
|
328
387
|
}
|
|
329
388
|
if (mode === "inline" || mode === "both") {
|
|
330
389
|
this.updateInlineValidationMessage();
|
|
@@ -371,6 +430,7 @@ var Interaction = class extends LitElement {
|
|
|
371
430
|
setInteractionValidity(isValid, validityMessage = "", anchor, options) {
|
|
372
431
|
const validityAnchor = anchor ?? this;
|
|
373
432
|
this._internals.setValidity(isValid ? {} : { customError: true }, validityMessage, validityAnchor);
|
|
433
|
+
this._validityKind = isValid ? void 0 : options?.kind ?? "other";
|
|
374
434
|
if (options?.suppressInline !== true && (this.validationDisplayMode === "inline" || this.validationDisplayMode === "both")) {
|
|
375
435
|
this.updateInlineValidationMessage();
|
|
376
436
|
}
|
|
@@ -400,9 +460,11 @@ var Interaction = class extends LitElement {
|
|
|
400
460
|
return this.shadowRoot?.querySelector("#validation-message");
|
|
401
461
|
}
|
|
402
462
|
reset() {
|
|
463
|
+
this.resetValidityReport();
|
|
403
464
|
this.response = null;
|
|
404
465
|
}
|
|
405
466
|
formResetCallback() {
|
|
467
|
+
this.resetValidityReport();
|
|
406
468
|
this.reset();
|
|
407
469
|
}
|
|
408
470
|
connectedCallback() {
|
|
@@ -432,6 +494,24 @@ var Interaction = class extends LitElement {
|
|
|
432
494
|
}
|
|
433
495
|
}));
|
|
434
496
|
}
|
|
497
|
+
/**
|
|
498
|
+
* `disabled` and `readonly` are states as well as attributes (qti-theme CONTRACT.md §3): a theme
|
|
499
|
+
* reads `:state(disabled)` on the host the way it reads it on a choice. The attribute stays
|
|
500
|
+
* reflected, so `[disabled]` keeps matching.
|
|
501
|
+
*/
|
|
502
|
+
update(changed) {
|
|
503
|
+
const first = !this.hasUpdated;
|
|
504
|
+
super.update(changed);
|
|
505
|
+
if (first) {
|
|
506
|
+
const run = () => this.isConnected && this.validate();
|
|
507
|
+
void this.updateComplete.then(run);
|
|
508
|
+
requestAnimationFrame(() => requestAnimationFrame(run));
|
|
509
|
+
}
|
|
510
|
+
if (changed.has("disabled"))
|
|
511
|
+
setState(this._internals.states, "disabled", this.disabled);
|
|
512
|
+
if (changed.has("readonly"))
|
|
513
|
+
setState(this._internals.states, "readonly", this.readonly);
|
|
514
|
+
}
|
|
435
515
|
constructor() {
|
|
436
516
|
super();
|
|
437
517
|
this.#itemContext = new ContextConsumer(this, {
|
|
@@ -444,7 +524,17 @@ var Interaction = class extends LitElement {
|
|
|
444
524
|
this._interactionContext = { choiceRole: null, draggablesSelector: null };
|
|
445
525
|
this.disabled = false;
|
|
446
526
|
this.readonly = false;
|
|
527
|
+
this._validityReported = false;
|
|
528
|
+
this._reportingNatively = false;
|
|
447
529
|
this._internals = this.attachInternals();
|
|
530
|
+
this.addEventListener("invalid", () => {
|
|
531
|
+
if (this._reportingNatively)
|
|
532
|
+
return;
|
|
533
|
+
this._validityReported = true;
|
|
534
|
+
if (this.validationDisplayMode === "inline" || this.validationDisplayMode === "both") {
|
|
535
|
+
this.updateInlineValidationMessage();
|
|
536
|
+
}
|
|
537
|
+
});
|
|
448
538
|
this.addEventListener("qti-interaction-response", (e) => {
|
|
449
539
|
this.#lastResponse = JSON.stringify(e.detail?.response ?? null);
|
|
450
540
|
});
|
|
@@ -803,6 +893,7 @@ var QtiFeedback = class extends LitElement4 {
|
|
|
803
893
|
subscribe: true,
|
|
804
894
|
callback: (context) => this.#followItem(context)
|
|
805
895
|
});
|
|
896
|
+
this.#hostShows = false;
|
|
806
897
|
}
|
|
807
898
|
/**
|
|
808
899
|
* The item's variables. Feedback follows them itself: every time the item publishes a new context
|
|
@@ -844,12 +935,38 @@ var QtiFeedback = class extends LitElement4 {
|
|
|
844
935
|
}
|
|
845
936
|
this.#showFeedback(isFound);
|
|
846
937
|
}
|
|
938
|
+
/** The host cancelled the show: it has this feedback, and is not asked again until the condition has gone. */
|
|
939
|
+
#hostShows;
|
|
847
940
|
#showFeedback(value) {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
941
|
+
const next = this.#sessionControlAllowsFeedback() && this.#conditionHolds(value) ? "on" : "off";
|
|
942
|
+
if (next === "on") {
|
|
943
|
+
if (this.showStatus === "on" || this.#hostShows)
|
|
944
|
+
return;
|
|
945
|
+
if (!this.feedbackShowing()) {
|
|
946
|
+
this.#hostShows = true;
|
|
947
|
+
this.showStatus = "off";
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
} else {
|
|
951
|
+
this.#hostShows = false;
|
|
952
|
+
if (this.showStatus === "on" && !this.feedbackHiding())
|
|
953
|
+
return;
|
|
851
954
|
}
|
|
852
|
-
this.showStatus =
|
|
955
|
+
this.showStatus = next;
|
|
956
|
+
}
|
|
957
|
+
#conditionHolds(value) {
|
|
958
|
+
return value && this.showHide === "show" || !value && this.showHide === "hide";
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Called when this feedback is about to show. Return `false` to keep it hidden: the host shows the
|
|
962
|
+
* content itself. The elements dispatch `qc-feedback-show` here.
|
|
963
|
+
*/
|
|
964
|
+
feedbackShowing() {
|
|
965
|
+
return true;
|
|
966
|
+
}
|
|
967
|
+
/** Called when this feedback is about to hide. Return `false` to keep it showing: the host hides it itself. */
|
|
968
|
+
feedbackHiding() {
|
|
969
|
+
return true;
|
|
853
970
|
}
|
|
854
971
|
/**
|
|
855
972
|
* The QTI `show-feedback` constraint governs exactly one state: after the end of
|
|
@@ -870,11 +987,11 @@ var QtiFeedback = class extends LitElement4 {
|
|
|
870
987
|
if (!this._computedContext)
|
|
871
988
|
return true;
|
|
872
989
|
const activeItem = this._computedContext.testParts?.find((tp) => tp.active)?.sections.flatMap((s) => s.items).find((i) => i.active);
|
|
873
|
-
if (!activeItem || activeItem.showFeedback)
|
|
990
|
+
if (!activeItem || activeItem.sessionControl?.showFeedback)
|
|
874
991
|
return true;
|
|
875
992
|
if (activeItem.adaptive)
|
|
876
993
|
return activeItem.completionStatus !== "completed";
|
|
877
|
-
const maxAttempts = activeItem.maxAttempts ?? 1;
|
|
994
|
+
const maxAttempts = activeItem.sessionControl?.maxAttempts ?? 1;
|
|
878
995
|
if (maxAttempts <= 0)
|
|
879
996
|
return true;
|
|
880
997
|
const numAttempts = Number(this._context?.variables?.find((v) => v.identifier === "numAttempts")?.value) || 0;
|
|
@@ -984,6 +1101,39 @@ function responseAttributeConverter(opts) {
|
|
|
984
1101
|
};
|
|
985
1102
|
}
|
|
986
1103
|
|
|
1104
|
+
// ../qti-base/dist/lib/record.js
|
|
1105
|
+
var isRecordValue = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1106
|
+
var readRecordFieldValues = (valueElements) => {
|
|
1107
|
+
const value = {};
|
|
1108
|
+
const baseTypes = {};
|
|
1109
|
+
for (const element of valueElements) {
|
|
1110
|
+
const fieldIdentifier = element.getAttribute("field-identifier");
|
|
1111
|
+
if (!fieldIdentifier)
|
|
1112
|
+
continue;
|
|
1113
|
+
value[fieldIdentifier] = element.textContent?.trim() ?? "";
|
|
1114
|
+
const baseType = element.getAttribute("base-type");
|
|
1115
|
+
if (baseType)
|
|
1116
|
+
baseTypes[fieldIdentifier] = baseType;
|
|
1117
|
+
}
|
|
1118
|
+
return { value, baseTypes };
|
|
1119
|
+
};
|
|
1120
|
+
var NUMBER = /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;
|
|
1121
|
+
var inferRecordFieldBaseType = (value) => {
|
|
1122
|
+
if (typeof value === "number")
|
|
1123
|
+
return Number.isInteger(value) ? "integer" : "float";
|
|
1124
|
+
if (typeof value === "boolean")
|
|
1125
|
+
return "boolean";
|
|
1126
|
+
if (typeof value !== "string")
|
|
1127
|
+
return "string";
|
|
1128
|
+
const text = value.trim();
|
|
1129
|
+
if (NUMBER.test(text))
|
|
1130
|
+
return "float";
|
|
1131
|
+
const parts = text.split(/\s+/);
|
|
1132
|
+
if (parts.length === 2 && parts.every((part) => NUMBER.test(part)))
|
|
1133
|
+
return "point";
|
|
1134
|
+
return "string";
|
|
1135
|
+
};
|
|
1136
|
+
|
|
987
1137
|
// ../qti-base/dist/lib/qti-rule-base.js
|
|
988
1138
|
import { LitElement as LitElement5 } from "lit";
|
|
989
1139
|
var QtiRuleElement = class extends LitElement5 {
|
|
@@ -1219,6 +1369,9 @@ export {
|
|
|
1219
1369
|
boxSizing,
|
|
1220
1370
|
dropRegion,
|
|
1221
1371
|
validationMessage,
|
|
1372
|
+
STATE_ALIASES,
|
|
1373
|
+
setState,
|
|
1374
|
+
hasState,
|
|
1222
1375
|
Interaction,
|
|
1223
1376
|
QtiVariableDeclaration,
|
|
1224
1377
|
QtiExpression,
|
|
@@ -1236,6 +1389,9 @@ export {
|
|
|
1236
1389
|
parsePoint,
|
|
1237
1390
|
serializePoint,
|
|
1238
1391
|
responseAttributeConverter,
|
|
1392
|
+
isRecordValue,
|
|
1393
|
+
readRecordFieldValues,
|
|
1394
|
+
inferRecordFieldBaseType,
|
|
1239
1395
|
QtiRuleElement,
|
|
1240
1396
|
QtiExitResponseSignal,
|
|
1241
1397
|
QtiExitTestSignal,
|
|
@@ -1244,4 +1400,4 @@ export {
|
|
|
1244
1400
|
getCustomOperator,
|
|
1245
1401
|
ScoringHelper
|
|
1246
1402
|
};
|
|
1247
|
-
//# sourceMappingURL=chunk-
|
|
1403
|
+
//# sourceMappingURL=chunk-GPC53O7P.js.map
|