@citolab/qti-components 9.1.0 → 9.2.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 (75) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +208 -200
  3. package/dist/base.d.ts +54 -11
  4. package/dist/base.js +11 -1
  5. package/dist/{chunk-QCPN7E6K.js → chunk-7PXUE2GR.js} +3375 -3251
  6. package/dist/chunk-7PXUE2GR.js.map +1 -0
  7. package/dist/{chunk-XE7BALDO.js → chunk-A32YH4H5.js} +2 -2
  8. package/dist/{chunk-XE7BALDO.js.map → chunk-A32YH4H5.js.map} +1 -1
  9. package/dist/{chunk-MKZ374OJ.js → chunk-FG5JAWSN.js} +2 -2
  10. package/dist/{chunk-3VQSUWCK.js → chunk-G5RQ5GKG.js} +407 -131
  11. package/dist/chunk-G5RQ5GKG.js.map +1 -0
  12. package/dist/{chunk-5SU3MP6Y.js → chunk-GPGUXZ3X.js} +20 -6
  13. package/dist/{chunk-5SU3MP6Y.js.map → chunk-GPGUXZ3X.js.map} +1 -1
  14. package/dist/{chunk-5BXJRO5O.js → chunk-JGPWBIVD.js} +389 -229
  15. package/dist/chunk-JGPWBIVD.js.map +1 -0
  16. package/dist/{chunk-RT6WZ3P7.js → chunk-JLZCZVRX.js} +2 -2
  17. package/dist/{chunk-6ITD55QE.js → chunk-LFVPS7KB.js} +2 -2
  18. package/dist/{chunk-DAUU2NJL.js → chunk-RAJQKCQ3.js} +66 -9
  19. package/dist/chunk-RAJQKCQ3.js.map +1 -0
  20. package/dist/{chunk-WKWCOV5P.js → chunk-REKCRWJV.js} +83 -21
  21. package/dist/chunk-REKCRWJV.js.map +1 -0
  22. package/dist/{chunk-HDEG6BAZ.js → chunk-TLAVOBEM.js} +16 -8
  23. package/dist/chunk-TLAVOBEM.js.map +1 -0
  24. package/dist/{chunk-LDY4C2OT.js → chunk-YIYHCHHM.js} +2 -2
  25. package/dist/{chunk-WCWJPIUQ.js → chunk-YVZWNLF4.js} +191 -52
  26. package/dist/chunk-YVZWNLF4.js.map +1 -0
  27. package/dist/{chunk-KCK27QBP.js → chunk-ZG7FBQFP.js} +2 -2
  28. package/dist/{chunk-XYQNTF5B.js → chunk-ZOQVTG5L.js} +2 -2
  29. package/dist/{computed.types.d-CJarqC6s.d.ts → computed.types.d-DB5gfOh9.d.ts} +2 -16
  30. package/dist/corrections.d.ts +21 -10
  31. package/dist/corrections.js +20 -20
  32. package/dist/corrections.js.map +1 -1
  33. package/dist/elements.d.ts +43 -11
  34. package/dist/elements.js +4 -4
  35. package/dist/index.d.ts +14 -13
  36. package/dist/index.js +37 -15
  37. package/dist/{interaction.d-CJiMv8H7.d.ts → interaction.d-DegNJ5ZA.d.ts} +1 -1
  38. package/dist/interactions.d.ts +35 -35
  39. package/dist/interactions.js +3 -3
  40. package/dist/item.css +11 -2
  41. package/dist/item.d.ts +31 -82
  42. package/dist/item.js +7 -5
  43. package/dist/{item.types.d-QU7LljEK.d.ts → item.types.d-BDFrq19E.d.ts} +18 -2
  44. package/dist/loader.d.ts +3 -3
  45. package/dist/loader.js +2 -2
  46. package/dist/processing.d.ts +139 -20
  47. package/dist/processing.js +11 -3
  48. package/dist/qti-components-jsx.d.ts +1947 -98
  49. package/dist/{qti-condition-expression.d-CYwXOUb1.d.ts → qti-condition-expression.d-DLboq8bR.d.ts} +1 -1
  50. package/dist/{qti-expression.d-B_-m9emA.d.ts → qti-expression.d-BksT9iLB.d.ts} +26 -3
  51. package/dist/{qti-feedback.d-B1EIF-fU.d.ts → qti-feedback.d-D-w6-mJv.d.ts} +1 -1
  52. package/dist/qti-item.d-D_-9_0e6.d.ts +101 -0
  53. package/dist/qti-rule-base.d-Bdzg8eGH.d.ts +41 -0
  54. package/dist/{qti-test.d-C6lCEMRB.d.ts → qti-test.d-BfAZE6UF.d.ts} +61 -9
  55. package/dist/{qti-text-entry-interaction.d-BGdfV9qG.d.ts → qti-text-entry-interaction.d-CATtcPyX.d.ts} +10 -9
  56. package/dist/session.context.d-Cjs0BkJB.d.ts +33 -0
  57. package/dist/test.d.ts +8 -8
  58. package/dist/test.js +8 -6
  59. package/dist/transformers.js +1 -1
  60. package/package.json +12 -11
  61. package/dist/chunk-3VQSUWCK.js.map +0 -1
  62. package/dist/chunk-5BXJRO5O.js.map +0 -1
  63. package/dist/chunk-DAUU2NJL.js.map +0 -1
  64. package/dist/chunk-HDEG6BAZ.js.map +0 -1
  65. package/dist/chunk-QCPN7E6K.js.map +0 -1
  66. package/dist/chunk-WCWJPIUQ.js.map +0 -1
  67. package/dist/chunk-WKWCOV5P.js.map +0 -1
  68. package/dist/computed-item.types.d-BKZdSLLJ.d.ts +0 -19
  69. package/dist/qti-rule-base.d-ajOnfGXY.d.ts +0 -16
  70. /package/dist/{chunk-MKZ374OJ.js.map → chunk-FG5JAWSN.js.map} +0 -0
  71. /package/dist/{chunk-RT6WZ3P7.js.map → chunk-JLZCZVRX.js.map} +0 -0
  72. /package/dist/{chunk-6ITD55QE.js.map → chunk-LFVPS7KB.js.map} +0 -0
  73. /package/dist/{chunk-LDY4C2OT.js.map → chunk-YIYHCHHM.js.map} +0 -0
  74. /package/dist/{chunk-KCK27QBP.js.map → chunk-ZG7FBQFP.js.map} +0 -0
  75. /package/dist/{chunk-XYQNTF5B.js.map → chunk-ZOQVTG5L.js.map} +0 -0
package/dist/base.d.ts CHANGED
@@ -1,18 +1,19 @@
1
- import { C as ComputedItemContext } from './computed-item.types.d-BKZdSLLJ.js';
2
- import { C as ComputedContext } from './computed.types.d-CJarqC6s.js';
3
- export { a as ComputedItem, I as INITIAL_SESSION_CONTEXT, S as SessionContext, V as View, s as sessionContext } from './computed.types.d-CJarqC6s.js';
1
+ import { C as ComputedItemContext } from './session.context.d-Cjs0BkJB.js';
2
+ export { I as INITIAL_SESSION_CONTEXT, S as SessionContext, V as View, s as sessionContext } from './session.context.d-Cjs0BkJB.js';
3
+ import { C as ComputedContext } from './computed.types.d-DB5gfOh9.js';
4
+ export { a as ComputedItem } from './computed.types.d-DB5gfOh9.js';
4
5
  export { C as ConfigContext, V as ValidationDisplayMode, c as configContext } from './config.context.d-BvU9r-Mg.js';
5
- export { C as ChoiceRole, I as Interaction, a as InteractionContext, i as interactionContext } from './interaction.d-CJiMv8H7.js';
6
- import { I as ItemContext, B as BaseType } from './item.types.d-QU7LljEK.js';
7
- export { C as Calculate, a as Cardinality, 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, l as itemContextVariables } from './item.types.d-QU7LljEK.js';
6
+ export { C as ChoiceRole, I as Interaction, a as InteractionContext, i as interactionContext } from './interaction.d-DegNJ5ZA.js';
7
+ import { b as ItemContext, B as BaseType } from './item.types.d-BDFrq19E.js';
8
+ export { C as Calculate, a as Cardinality, I as InterpolationTableEntry, M as Multiple, O as Ordered, c as OutcomeVariable, Q as QtiAreaMapEntry, d as QtiAreaMapping, e as QtiMapEntry, f as QtiMapping, R as ResponseInteraction, g as ResponseVariable, T as TemplateVariable, V as VariableDeclaration, h as VariableValue, i as areaShape, j as directedPair, k as float, l as integer, m as itemContextVariables } from './item.types.d-BDFrq19E.js';
8
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';
9
- export { I as INITIAL_TEST_CONTEXT, Q as QtiExpression, a as QtiExpressionBase, T as TestContext, t as testContext } from './qti-expression.d-B_-m9emA.js';
10
+ export { I as INITIAL_TEST_CONTEXT, Q as QtiExpression, a as QtiExpressionBase, T as TestContext, t as testContext } from './qti-expression.d-BksT9iLB.js';
10
11
  import * as lit from 'lit';
11
- export { Q as QtiFeedback, a as QtiVariableDeclaration } from './qti-feedback.d-B1EIF-fU.js';
12
- export { Q as QtiConditionExpression } from './qti-condition-expression.d-CYwXOUb1.js';
12
+ export { Q as QtiFeedback, a as QtiVariableDeclaration } from './qti-feedback.d-D-w6-mJv.js';
13
+ export { Q as QtiConditionExpression } from './qti-condition-expression.d-DLboq8bR.js';
13
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';
14
15
  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';
15
- export { Q as QtiRuleBase, a as QtiRuleElement } from './qti-rule-base.d-ajOnfGXY.js';
16
+ export { Q as QtiExitResponseSignal, a as QtiExitTestSignal, b as QtiRuleBase, c as QtiRuleElement } from './qti-rule-base.d-Bdzg8eGH.js';
16
17
 
17
18
  declare const computedItemContext: {
18
19
  __context__: Readonly<ComputedItemContext>;
@@ -102,6 +103,38 @@ declare const dropRegion: lit.CSSResult;
102
103
  */
103
104
  declare const validationMessage: lit.CSSResult;
104
105
 
106
+ /**
107
+ * The registry behind `<qti-custom-operator definition="…">`.
108
+ *
109
+ * A custom operator is by definition outside the QTI vocabulary, so which ones
110
+ * exist is a property of the delivery engine rather than of an item. An item
111
+ * names one in its `definition` attribute and the engine supplies it — here,
112
+ * through this registry.
113
+ *
114
+ * This is the second of two mechanisms on `qti-custom-operator`. The other runs
115
+ * inline JavaScript out of a CDATA section and is selected with
116
+ * `class="js.org"`; it stays as it is. `definition` is what items authored
117
+ * against the Citolab scoring engine use, and the two do not interact.
118
+ */
119
+ type CustomOperatorValue = string | string[] | number | boolean | null;
120
+ /**
121
+ * Handed the calculated values of the element's child expressions, in document
122
+ * order, and returns the value of the expression.
123
+ */
124
+ type CustomOperator = (values: CustomOperatorValue[]) => CustomOperatorValue;
125
+ /**
126
+ * Make an operator available to every `qti-custom-operator` that names it.
127
+ *
128
+ * The key is the `definition` attribute in full, prefix included. Registering a
129
+ * key a built-in already uses overrides that built-in, which is how a delivery
130
+ * engine replaces one it disagrees with.
131
+ */
132
+ declare const registerCustomOperator: (definition: string, operator: CustomOperator) => void;
133
+ /** Undo a {@link registerCustomOperator}, restoring any built-in of that name. */
134
+ declare const unregisterCustomOperator: (definition: string) => void;
135
+ /** The operator for a `definition`, or null when nothing provides it. */
136
+ declare const getCustomOperator: (definition: string) => CustomOperator | null;
137
+
105
138
  /**
106
139
  * Custom-state support shim for browsers this library cannot use natively.
107
140
  *
@@ -185,8 +218,18 @@ declare class ScoringHelper {
185
218
  }
186
219
 
187
220
  declare const decimalSeparator: () => string;
221
+ /**
222
+ * Renders a number the way QTI stores one: a plain decimal string with `.` as the separator and no
223
+ * grouping, whatever the browser's locale is. Strings are already in that form and pass through.
224
+ *
225
+ * `Number.prototype.toString()` is exactly that format. The locale-aware versions this used to call
226
+ * are not: under a comma-decimal locale (nl, de, fr, ...) it ran `.replace('.', '')` over a string
227
+ * that always uses `.`, so a score of 0.5 was stored as "05" and 1.5 as "15" — an item's SCORE came
228
+ * out ten times too big for every value with a fraction. Under a dot-decimal locale
229
+ * `toLocaleString()` grouped thousands instead, turning 1234.5 into "1,234.5".
230
+ */
188
231
  declare const convertNumberToUniversalFormat: (number: number | string) => string;
189
232
  declare function IsNullOrUndefined(value: unknown): boolean;
190
233
  declare function removeDoubleSlashes(str: string): string;
191
234
 
192
- export { BaseType, ComputedContext, ComputedItemContext, CustomStateSetShim, type CustomStateSupport, IsNullOrUndefined, ItemContext, ScoringHelper, boxSizing, classifyCustomStateSupport, computedContext, computedItemContext, convertNumberToUniversalFormat, decimalSeparator, dropRegion, installCustomStateSetFallback, itemContext, removeDoubleSlashes, validationMessage };
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 };
package/dist/base.js CHANGED
@@ -5,6 +5,8 @@ import {
5
5
  Interaction,
6
6
  IsNullOrUndefined,
7
7
  QtiConditionExpression,
8
+ QtiExitResponseSignal,
9
+ QtiExitTestSignal,
8
10
  QtiExpression,
9
11
  QtiFeedback,
10
12
  QtiRuleElement,
@@ -19,6 +21,7 @@ import {
19
21
  convertNumberToUniversalFormat,
20
22
  decimalSeparator,
21
23
  dropRegion,
24
+ getCustomOperator,
22
25
  installCustomStateSetFallback,
23
26
  interactionContext,
24
27
  isSeed,
@@ -29,6 +32,7 @@ import {
29
32
  parsePoint,
30
33
  parseResponseAttribute,
31
34
  qtiContext,
35
+ registerCustomOperator,
32
36
  removeDoubleSlashes,
33
37
  responseAttributeConverter,
34
38
  serializePair,
@@ -36,8 +40,9 @@ import {
36
40
  serializeResponseAttribute,
37
41
  sessionContext,
38
42
  testContext,
43
+ unregisterCustomOperator,
39
44
  validationMessage
40
- } from "./chunk-WCWJPIUQ.js";
45
+ } from "./chunk-YVZWNLF4.js";
41
46
  export {
42
47
  CustomStateSetShim,
43
48
  INITIAL_SESSION_CONTEXT,
@@ -45,6 +50,8 @@ export {
45
50
  Interaction,
46
51
  IsNullOrUndefined,
47
52
  QtiConditionExpression,
53
+ QtiExitResponseSignal,
54
+ QtiExitTestSignal,
48
55
  QtiExpression,
49
56
  QtiFeedback,
50
57
  QtiRuleElement,
@@ -59,6 +66,7 @@ export {
59
66
  convertNumberToUniversalFormat,
60
67
  decimalSeparator,
61
68
  dropRegion,
69
+ getCustomOperator,
62
70
  installCustomStateSetFallback,
63
71
  interactionContext,
64
72
  isSeed,
@@ -69,6 +77,7 @@ export {
69
77
  parsePoint,
70
78
  parseResponseAttribute,
71
79
  qtiContext,
80
+ registerCustomOperator,
72
81
  removeDoubleSlashes,
73
82
  responseAttributeConverter,
74
83
  serializePair,
@@ -76,6 +85,7 @@ export {
76
85
  serializeResponseAttribute,
77
86
  sessionContext,
78
87
  testContext,
88
+ unregisterCustomOperator,
79
89
  validationMessage
80
90
  };
81
91
  //# sourceMappingURL=base.js.map