@citolab/qti-components 9.4.0 → 10.0.0-next.1

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 (57) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +290 -243
  3. package/dist/base.d.ts +2 -2
  4. package/dist/base.js +1 -1
  5. package/dist/{chunk-C3JPUV36.js → chunk-35WWWFS6.js} +2 -2
  6. package/dist/{chunk-3BAQWO5C.js → chunk-6K3QWJHH.js} +2 -2
  7. package/dist/{chunk-XEWGFAS4.js → chunk-6U3YPHXU.js} +67 -27
  8. package/dist/chunk-6U3YPHXU.js.map +1 -0
  9. package/dist/{chunk-GNTO3IFM.js → chunk-CKJ7M7JQ.js} +571 -375
  10. package/dist/chunk-CKJ7M7JQ.js.map +1 -0
  11. package/dist/{chunk-BMXG7D2N.js → chunk-FD4AB6TM.js} +2 -2
  12. package/dist/{chunk-LKHRHFXO.js → chunk-FWR6HZQS.js} +6 -6
  13. package/dist/{chunk-B5XHZI2P.js → chunk-GBZNFSFY.js} +2 -2
  14. package/dist/{chunk-ACRN7YJM.js → chunk-MI7774NV.js} +2 -2
  15. package/dist/{chunk-MSGYZE6L.js → chunk-RSMYGGQK.js} +128 -48
  16. package/dist/chunk-RSMYGGQK.js.map +1 -0
  17. package/dist/{chunk-B74SYQB2.js → chunk-RU6332MD.js} +3 -3
  18. package/dist/{chunk-R7MMMDP7.js → chunk-TDWJ6WZA.js} +20 -2
  19. package/dist/chunk-TDWJ6WZA.js.map +1 -0
  20. package/dist/{chunk-JHPQJDAV.js → chunk-YYIS6FDP.js} +2 -2
  21. package/dist/chunk-ZP6QQYSU.js +7 -0
  22. package/dist/chunk-ZP6QQYSU.js.map +1 -0
  23. package/dist/corrections.d.ts +3 -3
  24. package/dist/corrections.js +8 -8
  25. package/dist/elements.d.ts +64 -2
  26. package/dist/elements.js +15 -5
  27. package/dist/index.d.ts +5 -5
  28. package/dist/index.js +28 -14
  29. package/dist/interactions.d.ts +2 -2
  30. package/dist/interactions.js +3 -3
  31. package/dist/item.css +11 -0
  32. package/dist/item.js +4 -4
  33. package/dist/loader.d.ts +1 -1
  34. package/dist/processing.d.ts +2 -2
  35. package/dist/processing.js +3 -3
  36. package/dist/qti-components-jsx.d.ts +138 -191
  37. package/dist/{qti-condition-expression.d-L7yb3Rzy.d.ts → qti-condition-expression.d-VJH6cWxf.d.ts} +1 -1
  38. package/dist/{qti-expression.d-CuaLjZ6g.d.ts → qti-expression.d-BPxEp8HU.d.ts} +7 -0
  39. package/dist/{qti-test.d-Cud5Gvy0.d.ts → qti-test.d-DkpBNcsv.d.ts} +67 -9
  40. package/dist/{qti-text-entry-interaction.d-DKvz9ncv.d.ts → qti-text-entry-interaction.d-q8u5BiVK.d.ts} +11 -2
  41. package/dist/test.d.ts +3 -3
  42. package/dist/test.js +9 -5
  43. package/package.json +10 -10
  44. package/dist/chunk-A32YH4H5.js +0 -7
  45. package/dist/chunk-A32YH4H5.js.map +0 -1
  46. package/dist/chunk-GNTO3IFM.js.map +0 -1
  47. package/dist/chunk-MSGYZE6L.js.map +0 -1
  48. package/dist/chunk-R7MMMDP7.js.map +0 -1
  49. package/dist/chunk-XEWGFAS4.js.map +0 -1
  50. /package/dist/{chunk-C3JPUV36.js.map → chunk-35WWWFS6.js.map} +0 -0
  51. /package/dist/{chunk-3BAQWO5C.js.map → chunk-6K3QWJHH.js.map} +0 -0
  52. /package/dist/{chunk-BMXG7D2N.js.map → chunk-FD4AB6TM.js.map} +0 -0
  53. /package/dist/{chunk-LKHRHFXO.js.map → chunk-FWR6HZQS.js.map} +0 -0
  54. /package/dist/{chunk-B5XHZI2P.js.map → chunk-GBZNFSFY.js.map} +0 -0
  55. /package/dist/{chunk-ACRN7YJM.js.map → chunk-MI7774NV.js.map} +0 -0
  56. /package/dist/{chunk-B74SYQB2.js.map → chunk-RU6332MD.js.map} +0 -0
  57. /package/dist/{chunk-JHPQJDAV.js.map → chunk-YYIS6FDP.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { Q as QtiExpression } from './qti-expression.d-CuaLjZ6g.js';
1
+ import { Q as QtiExpression } from './qti-expression.d-BPxEp8HU.js';
2
2
 
3
3
  declare abstract class QtiConditionExpression extends QtiExpression<boolean> {
4
4
  calculate(): Readonly<boolean>;
@@ -58,6 +58,13 @@ declare abstract class QtiExpression<T> extends LitElement implements QtiExpress
58
58
  * throwing, so callers degrade gracefully.
59
59
  */
60
60
  protected resolveVariable(identifier: string): VariableDeclaration<string | string[] | null> | null;
61
+ /**
62
+ * `ITEMREF.VAR`: a variable of an individual item session, looked up by prefixing the variable
63
+ * with the identifier the item ref gave the item (QTI 3 `qti-variable`), e.g. `Q01.SCORE`. An
64
+ * item that was never presented has no variables, which resolves to NULL. Instances of a cloned
65
+ * item (`Q01.2.SCORE`) are not supported: the item itself is used.
66
+ */
67
+ private resolveItemVariable;
61
68
  getVariables: () => ExpressionVariable[];
62
69
  }
63
70
 
@@ -4,7 +4,7 @@ import { b as transformTestApi, t as transformItemApi } from './qti-transform-te
4
4
  import { C as ComputedContext, a as ComputedItem } from './computed.types.d-gJrBeUMG.js';
5
5
  import { QtiAssessmentItem, QtiModalFeedback } from './elements.js';
6
6
  import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
7
- import { T as TestContext, Q as QtiExpression, a as QtiExpressionBase } from './qti-expression.d-CuaLjZ6g.js';
7
+ import { T as TestContext, Q as QtiExpression, a as QtiExpressionBase } from './qti-expression.d-BPxEp8HU.js';
8
8
  import { TemplateFunction } from '@heximal/templates';
9
9
  import { h as VariableValue, b as ItemContext, c as OutcomeVariable, V as VariableDeclaration } from './item.types.d-B55QkJ92.js';
10
10
  import { S as SessionContext, V as View } from './session.context.d-D5080LVx.js';
@@ -25,6 +25,11 @@ declare global {
25
25
  'qti-assessment-test': QtiAssessmentTest;
26
26
  }
27
27
  }
28
+ declare module '../../public-events' {
29
+ interface PublicEventMap {
30
+ 'cito-test-loaded': CustomEvent<QtiAssessmentTest>;
31
+ }
32
+ }
28
33
 
29
34
  /**
30
35
  * Defined here, and re-exported by the navigation mixin under the same name, so this file imports
@@ -123,6 +128,41 @@ declare global {
123
128
  }
124
129
  }
125
130
 
131
+ /** An element that evaluates to a boolean: a `qti-pre-condition` or `qti-branch-rule`. */
132
+ interface Condition extends Element {
133
+ evaluate(): boolean;
134
+ }
135
+
136
+ /**
137
+ * @summary The qti-branch-rule element jumps the test forward to `target` when its expression is true.
138
+ * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.branch-rule
139
+ *
140
+ * A child of `qti-test-part`, `qti-assessment-section` or `qti-assessment-item-ref`. It is
141
+ * evaluated after the parent has been presented; the first rule whose expression is true wins.
142
+ * Branch rules only apply in linear navigation mode. An expression that cannot be evaluated does
143
+ * not branch.
144
+ *
145
+ * @attr {string} target - Required. The identifier of an item ref, section or test part ahead of
146
+ * the parent, or one of the reserved targets `EXIT_SECTION`, `EXIT_TESTPART`, `EXIT_TEST`.
147
+ *
148
+ * @slot - The boolean expression.
149
+ */
150
+ declare class QtiBranchRule extends LitElement implements Condition {
151
+ static readonly EXIT_SECTION = "EXIT_SECTION";
152
+ static readonly EXIT_TESTPART = "EXIT_TESTPART";
153
+ static readonly EXIT_TEST = "EXIT_TEST";
154
+ static styles: lit.CSSResult;
155
+ target: string;
156
+ /** `true` when the test should jump to `target`. */
157
+ evaluate(): boolean;
158
+ render(): lit.TemplateResult<1>;
159
+ }
160
+ declare global {
161
+ interface HTMLElementTagNameMap {
162
+ 'qti-branch-rule': QtiBranchRule;
163
+ }
164
+ }
165
+
126
166
  /**
127
167
  * @summary The qti-item-session-control element contains configurations relating to flow of test sessions.
128
168
  * @documentation https://www.imsglobal.org/sites/default/files/spec/qti/v3/info/imsqti_asi_v3p0p1_infomodel_v1p0.html#Derived_ItemSessionControl
@@ -168,6 +208,31 @@ declare global {
168
208
  }
169
209
  }
170
210
 
211
+ /**
212
+ * @summary The qti-pre-condition element holds one boolean expression that decides whether its parent is presented.
213
+ * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.pre-condition
214
+ *
215
+ * A child of `qti-test-part`, `qti-assessment-section` or `qti-assessment-item-ref`. When the test
216
+ * is about to present the parent and the expression is false (or NULL), the parent is skipped.
217
+ * Pre-conditions only apply in linear navigation mode; in nonlinear mode they are ignored.
218
+ *
219
+ * Evaluation is pull-based, like every expression: the test calls `evaluate()` when it needs the
220
+ * answer. An expression that cannot be evaluated fails open, so the parent is shown.
221
+ *
222
+ * @slot - The boolean expression.
223
+ */
224
+ declare class QtiPreCondition extends LitElement implements Condition {
225
+ static styles: lit.CSSResult;
226
+ /** `true` when the parent may be presented. */
227
+ evaluate(): boolean;
228
+ render(): lit.TemplateResult<1>;
229
+ }
230
+ declare global {
231
+ interface HTMLElementTagNameMap {
232
+ 'qti-pre-condition': QtiPreCondition;
233
+ }
234
+ }
235
+
171
236
  declare class QtiOutcomeProcessing extends LitElement {
172
237
  static styles: lit.CSSResult[];
173
238
  render(): lit.TemplateResult<1>;
@@ -342,13 +407,6 @@ interface ITestStateMixin {
342
407
  state: QtiTestState;
343
408
  }
344
409
 
345
- type CustomEventMap = {
346
- 'test-end-attempt': CustomEvent;
347
- };
348
- declare global {
349
- interface GlobalEventHandlersEventMap extends CustomEventMap {
350
- }
351
- }
352
410
  declare class TestNavigation extends LitElement {
353
411
  #private;
354
412
  identifier: string | undefined;
@@ -1026,4 +1084,4 @@ declare global {
1026
1084
  }
1027
1085
  }
1028
1086
 
1029
- export { TestSectionLink as A, TestStamp as B, TestTtsNext as C, TestTtsPause as D, TestTtsPick as E, TestTtsPlay as F, TestTtsPrev as G, TestTtsResume as H, type ITestNavigationMixin as I, TestTtsStop as J, TestView as K, TestViewToggle as L, type TtsContext as M, ttsContext as N, type ItemVariableValue as O, QtiAssessmentItemRef as Q, type SpeechState as S, TestCheckItem as T, type ITestStateMixin as a, type ItemRefTemplateModel as b, QtiAssessmentSection as c, QtiAssessmentTest as d, QtiItemSessionControl as e, QtiNumberSelected as f, QtiOutcomeProcessing as g, QtiOutcomeProcessingProcessor as h, QtiTest as i, QtiTestFeedback as j, QtiTestPart as k, QtiTestVariables as l, QtiTestVariablesExpression as m, TestContainer as n, TestEndAttempt as o, TestItemLink as p, TestItemToSpeech as q, TestNavigation as r, TestNext as s, TestPagingButtonsStamp as t, TestPrev as u, TestPrintContext as v, TestPrintVariables as w, TestScoringButtons as x, TestScoringFeedback as y, TestSectionButtonsStamp as z };
1087
+ export { TestScoringFeedback as A, TestSectionButtonsStamp as B, TestSectionLink as C, TestStamp as D, TestTtsNext as E, TestTtsPause as F, TestTtsPick as G, TestTtsPlay as H, type ITestNavigationMixin as I, TestTtsPrev as J, TestTtsResume as K, TestTtsStop as L, TestView as M, TestViewToggle as N, type TtsContext as O, ttsContext as P, QtiAssessmentItemRef as Q, type ItemVariableValue as R, type SpeechState as S, TestCheckItem as T, type ITestStateMixin as a, type ItemRefTemplateModel as b, QtiAssessmentSection as c, QtiAssessmentTest as d, QtiBranchRule as e, QtiItemSessionControl as f, QtiNumberSelected as g, QtiOutcomeProcessing as h, QtiOutcomeProcessingProcessor as i, QtiPreCondition as j, QtiTest as k, QtiTestFeedback as l, QtiTestPart as m, QtiTestVariables as n, QtiTestVariablesExpression as o, TestContainer as p, TestEndAttempt as q, TestItemLink as r, TestItemToSpeech as s, TestNavigation as t, TestNext as u, TestPagingButtonsStamp as v, TestPrev as w, TestPrintContext as x, TestPrintVariables as y, TestScoringButtons as z };
@@ -608,7 +608,9 @@ declare global {
608
608
  * element renders a single textarea bound to one variable, so there is nothing for the bounds
609
609
  * to count: reading them as a word or paragraph limit would invent a rule QTI does not state.
610
610
  * Implement alongside multi-string rendering, not before it.
611
- * @attr {number} min-strings - Not implemented. See `max-strings`.
611
+ * @attr {number} [min-strings=0] - Whether a response is required. Below 1 an empty field is valid; from 1
612
+ * it must hold a value. Only that threshold is read: the field is a single string, so the
613
+ * count itself (see `max-strings`) has nothing to bound.
612
614
  * @attr {'plain'|'preformatted'|'xhtml'} [format=plain] - How the response is presented.
613
615
  * `preformatted` renders the field monospaced; `xhtml` is accepted but downgraded to plain,
614
616
  * because the field is a textarea with no rich-text editor behind it.
@@ -635,6 +637,8 @@ declare class QtiExtendedTextInteraction extends Interaction {
635
637
  */
636
638
  format: 'plain' | 'preformatted' | 'xhtml';
637
639
  protected _handleFormatChange: () => void;
640
+ /** Below 1 an empty field is valid; from 1 it must hold a value. Defaults to 0, as in the QTI spec. */
641
+ minStrings: number;
638
642
  patternMask: string;
639
643
  /** text appearing in the extended-text-interaction if it is empty */
640
644
  placeholderText: string;
@@ -1498,7 +1502,12 @@ declare class QtiSliderInteraction extends Interaction {
1498
1502
  step: number;
1499
1503
  validate(): boolean;
1500
1504
  connectedCallback(): void;
1501
- get response(): string;
1505
+ willUpdate(changed: PropertyValues): void;
1506
+ /**
1507
+ * Shows the value without publishing it: it came from the item (a default or a restored answer) or
1508
+ * from the host, which hold it already. Only the candidate's input is published.
1509
+ */
1510
+ get response(): string | null;
1502
1511
  set response(val: string | null);
1503
1512
  /** Extension hook for optional content rendered on the slider rail. */
1504
1513
  protected renderRailSupplement(): unknown;
package/dist/test.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { O as ItemVariableValue, I as ITestNavigationMixin, a as ITestStateMixin } from './qti-test.d-Cud5Gvy0.js';
2
- export { b as ItemRefTemplateModel, Q as QtiAssessmentItemRef, c as QtiAssessmentSection, d as QtiAssessmentTest, e as QtiItemSessionControl, f as QtiNumberSelected, g as QtiOutcomeProcessing, h as QtiOutcomeProcessingProcessor, i as QtiTest, j as QtiTestFeedback, k as QtiTestPart, l as QtiTestVariables, m as QtiTestVariablesExpression, S as SpeechState, T as TestCheckItem, n as TestContainer, o as TestEndAttempt, p as TestItemLink, q as TestItemToSpeech, r as TestNavigation, s as TestNext, t as TestPagingButtonsStamp, u as TestPrev, v as TestPrintContext, w as TestPrintVariables, x as TestScoringButtons, y as TestScoringFeedback, z as TestSectionButtonsStamp, A as TestSectionLink, B as TestStamp, C as TestTtsNext, D as TestTtsPause, E as TestTtsPick, F as TestTtsPlay, G as TestTtsPrev, H as TestTtsResume, J as TestTtsStop, K as TestView, L as TestViewToggle, M as TtsContext, N as ttsContext } from './qti-test.d-Cud5Gvy0.js';
1
+ import { R as ItemVariableValue, I as ITestNavigationMixin, a as ITestStateMixin } from './qti-test.d-DkpBNcsv.js';
2
+ export { b as ItemRefTemplateModel, Q as QtiAssessmentItemRef, c as QtiAssessmentSection, d as QtiAssessmentTest, e as QtiBranchRule, f as QtiItemSessionControl, g as QtiNumberSelected, h as QtiOutcomeProcessing, i as QtiOutcomeProcessingProcessor, j as QtiPreCondition, k as QtiTest, l as QtiTestFeedback, m as QtiTestPart, n as QtiTestVariables, o as QtiTestVariablesExpression, S as SpeechState, T as TestCheckItem, p as TestContainer, q as TestEndAttempt, r as TestItemLink, s as TestItemToSpeech, t as TestNavigation, u as TestNext, v as TestPagingButtonsStamp, w as TestPrev, x as TestPrintContext, y as TestPrintVariables, z as TestScoringButtons, A as TestScoringFeedback, B as TestSectionButtonsStamp, C as TestSectionLink, D as TestStamp, E as TestTtsNext, F as TestTtsPause, G as TestTtsPick, H as TestTtsPlay, J as TestTtsPrev, K as TestTtsResume, L as TestTtsStop, M as TestView, N as TestViewToggle, O as TtsContext, P as ttsContext } from './qti-test.d-DkpBNcsv.js';
3
3
  import { LitElement } from 'lit';
4
4
  import { b as ItemContext, c as OutcomeVariable, V as VariableDeclaration } from './item.types.d-B55QkJ92.js';
5
5
  import { S as SessionContext } from './session.context.d-D5080LVx.js';
6
6
  import { C as ConfigContext } from './config.context.d-BvU9r-Mg.js';
7
- import { T as TestContext } from './qti-expression.d-CuaLjZ6g.js';
7
+ import { T as TestContext } from './qti-expression.d-BPxEp8HU.js';
8
8
  import './qti-transform-test.d-BL7GGFJj.js';
9
9
  import './computed.types.d-gJrBeUMG.js';
10
10
  import './elements.js';
package/dist/test.js CHANGED
@@ -1,13 +1,15 @@
1
- import "./chunk-JHPQJDAV.js";
1
+ import "./chunk-YYIS6FDP.js";
2
2
  import {
3
3
  QTI_TEST_STATE_VERSION,
4
4
  QtiAssessmentItemRef,
5
5
  QtiAssessmentSection,
6
6
  QtiAssessmentTest,
7
+ QtiBranchRule,
7
8
  QtiItemSessionControl,
8
9
  QtiNumberSelected,
9
10
  QtiOutcomeProcessing,
10
11
  QtiOutcomeProcessingProcessor,
12
+ QtiPreCondition,
11
13
  QtiTest,
12
14
  QtiTestFeedback,
13
15
  QtiTestPart,
@@ -39,21 +41,23 @@ import {
39
41
  TestView,
40
42
  TestViewToggle,
41
43
  ttsContext
42
- } from "./chunk-GNTO3IFM.js";
43
- import "./chunk-XEWGFAS4.js";
44
- import "./chunk-A32YH4H5.js";
44
+ } from "./chunk-CKJ7M7JQ.js";
45
+ import "./chunk-6U3YPHXU.js";
46
+ import "./chunk-ZP6QQYSU.js";
45
47
  import "./chunk-4DB4SC5K.js";
46
48
  import "./chunk-TLAVOBEM.js";
47
- import "./chunk-R7MMMDP7.js";
49
+ import "./chunk-TDWJ6WZA.js";
48
50
  export {
49
51
  QTI_TEST_STATE_VERSION,
50
52
  QtiAssessmentItemRef,
51
53
  QtiAssessmentSection,
52
54
  QtiAssessmentTest,
55
+ QtiBranchRule,
53
56
  QtiItemSessionControl,
54
57
  QtiNumberSelected,
55
58
  QtiOutcomeProcessing,
56
59
  QtiOutcomeProcessingProcessor,
60
+ QtiPreCondition,
57
61
  QtiTest,
58
62
  QtiTestFeedback,
59
63
  QtiTestPart,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@citolab/qti-components",
3
3
  "description": "QTI component utilities",
4
- "version": "9.4.0",
4
+ "version": "10.0.0-next.1",
5
5
  "author": "",
6
6
  "dependencies": {
7
7
  "@heximal/templates": "^0.1.5",
@@ -10,15 +10,15 @@
10
10
  "lit-html": "^3.3.1"
11
11
  },
12
12
  "devDependencies": {
13
- "@qti-components/base": "^2.4.0",
14
- "@qti-components/corrections": "^0.4.0",
15
- "@qti-components/elements": "^1.9.0",
16
- "@qti-components/interactions": "^1.10.4",
17
- "@qti-components/item": "^1.5.0",
18
- "@qti-components/loader": "^1.3.3",
19
- "@qti-components/processing": "^1.6.0",
20
- "@qti-components/test": "^1.9.0",
21
- "@qti-components/theme": "^2.2.1",
13
+ "@qti-components/base": "^2.4.1-next.0",
14
+ "@qti-components/corrections": "^0.4.1-next.1",
15
+ "@qti-components/elements": "^1.10.0-next.1",
16
+ "@qti-components/interactions": "^1.10.5-next.1",
17
+ "@qti-components/item": "^1.5.1-next.1",
18
+ "@qti-components/loader": "^1.3.4-next.0",
19
+ "@qti-components/processing": "^1.6.1-next.0",
20
+ "@qti-components/test": "^1.10.0-next.1",
21
+ "@qti-components/theme": "^2.2.2-next.0",
22
22
  "@qti-components/transformers": "^1.7.3"
23
23
  },
24
24
  "exports": {