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

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 +4334 -2688
  3. package/dist/base.d.ts +39 -13
  4. package/dist/base.js +14 -1
  5. package/dist/{chunk-RU6332MD.js → chunk-2A52V5TQ.js} +4 -4
  6. package/dist/{chunk-2KP5UU5A.js → chunk-55WWIRLN.js} +117 -92
  7. package/dist/chunk-55WWIRLN.js.map +1 -0
  8. package/dist/{chunk-MI7774NV.js → chunk-5BP2A7BI.js} +2 -2
  9. package/dist/{chunk-35WWWFS6.js → chunk-DAESCCLR.js} +2 -2
  10. package/dist/chunk-DJ7PB252.js +7 -0
  11. package/dist/chunk-DJ7PB252.js.map +1 -0
  12. package/dist/{chunk-TDWJ6WZA.js → chunk-GPC53O7P.js} +166 -10
  13. package/dist/chunk-GPC53O7P.js.map +1 -0
  14. package/dist/{chunk-6U3YPHXU.js → chunk-H6DO5UHC.js} +277 -154
  15. package/dist/chunk-H6DO5UHC.js.map +1 -0
  16. package/dist/chunk-J6VX4N7M.js +197 -0
  17. package/dist/chunk-J6VX4N7M.js.map +1 -0
  18. package/dist/{chunk-3ZNECUPV.js → chunk-JIDSFFFD.js} +2 -2
  19. package/dist/{chunk-FD4AB6TM.js → chunk-KQ2LED4X.js} +2 -2
  20. package/dist/{chunk-6K3QWJHH.js → chunk-LPYZVKHX.js} +48 -7
  21. package/dist/chunk-LPYZVKHX.js.map +1 -0
  22. package/dist/chunk-PZ5AY32C.js +10 -0
  23. package/dist/chunk-PZ5AY32C.js.map +1 -0
  24. package/dist/{chunk-K3VKQ6QF.js → chunk-TB2OI3ED.js} +677 -1894
  25. package/dist/chunk-TB2OI3ED.js.map +1 -0
  26. package/dist/{chunk-GBZNFSFY.js → chunk-TSJGL6FI.js} +2 -2
  27. package/dist/{chunk-RSMYGGQK.js → chunk-TZCOXFPB.js} +1590 -610
  28. package/dist/chunk-TZCOXFPB.js.map +1 -0
  29. package/dist/chunk-UCXLDQYA.js +56 -0
  30. package/dist/chunk-UCXLDQYA.js.map +1 -0
  31. package/dist/chunk-WWY2H2YO.js +7 -0
  32. package/dist/chunk-WWY2H2YO.js.map +1 -0
  33. package/dist/{chunk-LFVPS7KB.js → chunk-XWRZP2RM.js} +2 -2
  34. package/dist/{chunk-TLAVOBEM.js → chunk-ZRORBAHB.js} +122 -3
  35. package/dist/chunk-ZRORBAHB.js.map +1 -0
  36. package/dist/computed.types.d-6Ht-HNRx.d.ts +80 -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 +47 -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 +1780 -1727
  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-CF9S8X9C.d.ts +68 -0
  63. package/dist/qti-test-state.d-D8Q89RzZ.d.ts +57 -0
  64. package/dist/{qti-test.d-DkpBNcsv.d.ts → qti-test.d-DBT-YpRu.d.ts} +124 -485
  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-Bb9vnLzP.d.ts} +1 -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 +134 -0
  70. package/dist/test-plugin-api.js +19 -0
  71. package/dist/test-plugin-api.js.map +1 -0
  72. package/dist/test.d.ts +26 -57
  73. package/dist/test.js +19 -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-2KP5UU5A.js.map +0 -1
  79. package/dist/chunk-6K3QWJHH.js.map +0 -1
  80. package/dist/chunk-6U3YPHXU.js.map +0 -1
  81. package/dist/chunk-K3VKQ6QF.js.map +0 -1
  82. package/dist/chunk-RSMYGGQK.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-RU6332MD.js.map → chunk-2A52V5TQ.js.map} +0 -0
  89. /package/dist/{chunk-MI7774NV.js.map → chunk-5BP2A7BI.js.map} +0 -0
  90. /package/dist/{chunk-35WWWFS6.js.map → chunk-DAESCCLR.js.map} +0 -0
  91. /package/dist/{chunk-3ZNECUPV.js.map → chunk-JIDSFFFD.js.map} +0 -0
  92. /package/dist/{chunk-FD4AB6TM.js.map → chunk-KQ2LED4X.js.map} +0 -0
  93. /package/dist/{chunk-GBZNFSFY.js.map → chunk-TSJGL6FI.js.map} +0 -0
  94. /package/dist/{chunk-LFVPS7KB.js.map → chunk-XWRZP2RM.js.map} +0 -0
package/dist/item.d.ts CHANGED
@@ -1,13 +1,15 @@
1
- export { I as ItemContainer, a as ItemPrintVariables, Q as QtiItem } from './qti-item.d-DgC1AQbY.js';
1
+ export { I as ItemContainer, a as ItemPrintVariables, Q as QtiItem } from './qti-item.d-CxP6KtCH.js';
2
2
  import { LitElement } from 'lit';
3
- import { V as View } from './session.context.d-D5080LVx.js';
3
+ import { V as View } from './session.context.d-9gRdGK4T.js';
4
+ import './public-events.d-3dGip9pd.js';
4
5
  import { QtiAssessmentItem } from './elements.js';
5
6
  import './qti.context.d-CejJMlfZ.js';
6
- import './config.context.d-BvU9r-Mg.js';
7
- import './item.types.d-B55QkJ92.js';
7
+ import './config.context.d-Dm11aAuw.js';
8
+ import './variables.d-DWHlTszN.js';
9
+ import './item.types.d-Zc6ZQDhu.js';
8
10
  import './interaction.interface.d-CvjHM2bi.js';
9
- import './qti-feedback.d-wMYNVkkj.js';
10
- import './qti-rule-base.d-Bdzg8eGH.js';
11
+ import './qti-feedback.d-CT0W-8Gm.js';
12
+ import './qti-rule-base.d-CeKP0Ooi.js';
11
13
 
12
14
  type Constructor<T = {}> = abstract new (...args: any[]) => T;
13
15
  declare class ItemViewInterface {
package/dist/item.js CHANGED
@@ -1,14 +1,15 @@
1
- import "./chunk-FD4AB6TM.js";
1
+ import "./chunk-KQ2LED4X.js";
2
2
  import {
3
3
  ItemContainer,
4
4
  ItemPrintVariables,
5
5
  ItemViewMixin,
6
6
  QtiItem
7
- } from "./chunk-RU6332MD.js";
8
- import "./chunk-ZP6QQYSU.js";
7
+ } from "./chunk-2A52V5TQ.js";
8
+ import "./chunk-WWY2H2YO.js";
9
9
  import "./chunk-4DB4SC5K.js";
10
- import "./chunk-TLAVOBEM.js";
11
- import "./chunk-TDWJ6WZA.js";
10
+ import "./chunk-ZRORBAHB.js";
11
+ import "./chunk-GPC53O7P.js";
12
+ import "./chunk-PZ5AY32C.js";
12
13
  export {
13
14
  ItemContainer,
14
15
  ItemPrintVariables,
@@ -0,0 +1,25 @@
1
+ import { V as VariableDeclaration } from './variables.d-DWHlTszN.js';
2
+
3
+ interface ItemContext {
4
+ identifier?: string;
5
+ href?: string;
6
+ variables?: ReadonlyArray<VariableDeclaration<string | string[] | null>>;
7
+ /**
8
+ * Optional per-interaction opaque state, keyed by responseIdentifier.
9
+ * Used for interactions that support state save/restore (e.g. PCI).
10
+ */
11
+ state?: Record<string, string | null>;
12
+ /** The item is shown for reading only. Interactions follow it; see `qti-assessment-item`'s `readonly`. */
13
+ readonly?: boolean;
14
+ /** The item is locked, for example after it was submitted. Interactions follow it; see `qti-assessment-item`'s `disabled`. */
15
+ disabled?: boolean;
16
+ /**
17
+ * Whether the interactions in the item are valid right now (a required answer is given, a limit is
18
+ * respected). Published by the item whenever it checks, so a reader never has to ask the item.
19
+ * Unset until the item has checked once.
20
+ */
21
+ valid?: boolean;
22
+ }
23
+ declare const itemContextVariables: VariableDeclaration<string | string[]>[];
24
+
25
+ export { type ItemContext as I, itemContextVariables as i };
package/dist/loader.d.ts CHANGED
@@ -1,9 +1,11 @@
1
+ import './public-events.d-3dGip9pd.js';
1
2
  import { QtiAssessmentItem } from './elements.js';
2
- import './item.types.d-B55QkJ92.js';
3
+ import './variables.d-DWHlTszN.js';
3
4
  import 'lit';
5
+ import './item.types.d-Zc6ZQDhu.js';
4
6
  import './interaction.interface.d-CvjHM2bi.js';
5
- import './qti-feedback.d-wMYNVkkj.js';
6
- import './qti-rule-base.d-Bdzg8eGH.js';
7
+ import './qti-feedback.d-CT0W-8Gm.js';
8
+ import './qti-rule-base.d-CeKP0Ooi.js';
7
9
 
8
10
  type ManifestInfo = {
9
11
  testIdentifier: string;
package/dist/loader.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  getItemByUri,
3
3
  getManifestInfo
4
- } from "./chunk-LFVPS7KB.js";
5
- import "./chunk-TLAVOBEM.js";
4
+ } from "./chunk-XWRZP2RM.js";
5
+ import "./chunk-ZRORBAHB.js";
6
+ import "./chunk-PZ5AY32C.js";
6
7
  export {
7
8
  getItemByUri,
8
9
  getManifestInfo
@@ -1,9 +1,10 @@
1
1
  import * as lit from 'lit';
2
2
  import { LitElement, nothing } from 'lit';
3
- import { b as QtiRuleBase } from './qti-rule-base.d-Bdzg8eGH.js';
4
- import { b as ItemContext, B as BaseType, g as ResponseVariable, V as VariableDeclaration } from './item.types.d-B55QkJ92.js';
5
- import { Q as QtiExpression, a as QtiExpressionBase, T as TestContext } from './qti-expression.d-BPxEp8HU.js';
6
- import { Q as QtiConditionExpression } from './qti-condition-expression.d-VJH6cWxf.js';
3
+ import { b as QtiRuleBase } from './qti-rule-base.d-CeKP0Ooi.js';
4
+ import { I as ItemContext } from './item.types.d-Zc6ZQDhu.js';
5
+ import { Q as QtiExpression, a as QtiExpressionBase, T as TestContext } from './qti-expression.d-iH3w6mqf.js';
6
+ import { Q as QtiConditionExpression } from './qti-condition-expression.d-7Kd4LBxn.js';
7
+ import { B as BaseType, f as ResponseVariable, V as VariableDeclaration } from './variables.d-DWHlTszN.js';
7
8
  import './qti.context.d-CejJMlfZ.js';
8
9
 
9
10
  declare class QtiRule extends LitElement implements QtiRuleBase {
@@ -69,7 +70,11 @@ declare abstract class QtiConditionElseBase extends QtiConditionBranchBase {
69
70
  * remaining children are the sub-rules processed when it evaluates to true.
70
71
  */
71
72
  declare abstract class QtiConditionIfBase extends QtiConditionBranchBase {
72
- shouldProcess(): Readonly<boolean>;
73
+ /**
74
+ * Variables and base values hold a boolean as the string `'true'` or `'false'`, and `'false'` is
75
+ * truthy, so the condition applies only to `true` itself; `false` and NULL do not.
76
+ */
77
+ shouldProcess(): boolean;
73
78
  getSubRules(): QtiRule[];
74
79
  }
75
80
  /**
@@ -444,8 +449,8 @@ declare class QtiIsNull extends QtiExpression<boolean> {
444
449
  * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.exit-response
445
450
  *
446
451
  * No rule after it runs, at any depth. The outcomes already set are kept: a
447
- * `qti-set-outcome-value` writes as it is processed, so everything before the
448
- * exit has landed by the time this throws.
452
+ * `qti-set-outcome-value` writes to the run's working copy as it is processed,
453
+ * and the item applies that copy once the run ends.
449
454
  */
450
455
  declare class QtiExitResponse extends QtiRule {
451
456
  process(): never;
@@ -481,6 +486,13 @@ declare global {
481
486
  * Special cases: Returns NULL if sub-expression is NULL or field does not exist.
482
487
  */
483
488
  declare class QtiFieldValue extends QtiExpression<string | string[] | null> {
489
+ #private;
490
+ /**
491
+ * The base type of the field last read: as declared on the record's correct response when it
492
+ * is, otherwise read off the value. The value alone is a string like `"4.1"` or `"455 250"`, and
493
+ * an operator reading it as text would refuse to compare it as a number or test it as a point.
494
+ */
495
+ get resultBaseType(): BaseType | undefined;
484
496
  /**
485
497
  * Every failure here is NULL rather than a thrown error. `qti-is-null` over a
486
498
  * `qti-field-value` is the specified way to ask whether a record carries a
@@ -1,4 +1,4 @@
1
- import "./chunk-MI7774NV.js";
1
+ import "./chunk-5BP2A7BI.js";
2
2
  import {
3
3
  QtiAnd,
4
4
  QtiAnyN,
@@ -76,8 +76,9 @@ import {
76
76
  QtiVariable,
77
77
  qtiAndMixin,
78
78
  qtiSubtractMixin
79
- } from "./chunk-6K3QWJHH.js";
80
- import "./chunk-TDWJ6WZA.js";
79
+ } from "./chunk-LPYZVKHX.js";
80
+ import "./chunk-GPC53O7P.js";
81
+ import "./chunk-PZ5AY32C.js";
81
82
  export {
82
83
  QtiAnd,
83
84
  QtiAnyN,
@@ -0,0 +1,105 @@
1
+ import { R as ResponseInteraction } from './variables.d-DWHlTszN.js';
2
+
3
+ interface OutcomeEntry {
4
+ identifier: string;
5
+ value: Readonly<string | string[] | null | undefined>;
6
+ }
7
+ /** One outcome an update applied, with its final value. */
8
+ interface OutcomeChangedDetails {
9
+ item: string;
10
+ outcomeIdentifier: string;
11
+ value: Readonly<string | string[]>;
12
+ }
13
+ /** The outcomes one update applied, sent after the item context is published. */
14
+ interface OutcomesChangedDetails {
15
+ item: string;
16
+ outcomes: OutcomeEntry[];
17
+ }
18
+ /**
19
+ * Outcomes for the item to apply in one update: the result of its own response processing, or what
20
+ * a backend returned. `responseProcessed` says an attempt ended, as it does after `processResponse`.
21
+ */
22
+ interface SetOutcomesDetails {
23
+ outcomes: OutcomeEntry[];
24
+ responseProcessed?: boolean;
25
+ }
26
+ type InteractionChangedDetails = ResponseInteraction & {
27
+ item: string;
28
+ };
29
+
30
+ /**
31
+ * The public events of the item. The name tells you it is public: everything declared here starts
32
+ * with `qc-`; every other event is internal plumbing and may change in any release.
33
+ *
34
+ * Requests are verbs, notifications are past tense. All bubble and are composed.
35
+ *
36
+ * `deprecated` is the `cito-` name the event had in 9.x. `dispatchPublic` sends and `listenPublic`
37
+ * handles both until the next major, then the field goes. The 7.x names (`qti-interaction-changed`,
38
+ * `qti-outcome-changed`, `qti-rubric:discretionary-placement`) are no longer sent or handled.
39
+ */
40
+ interface PublicEventDeclaration {
41
+ kind: 'request' | 'notification';
42
+ scope: 'test' | 'item';
43
+ /** The previous name. Dispatched and handled alongside the new one. */
44
+ deprecated?: string;
45
+ }
46
+ interface RubricPlacement {
47
+ className: string;
48
+ element: Element;
49
+ }
50
+ /** The detail of `qc-feedback-show` and `qc-feedback-hide`. */
51
+ interface FeedbackEventDetail {
52
+ kind: 'block' | 'inline' | 'modal';
53
+ /** The feedback's `identifier`. */
54
+ identifier: string;
55
+ /** The outcome it follows (`outcome-identifier`). */
56
+ outcomeIdentifier: string;
57
+ /** The feedback element itself: read or clone its content (it stays in the DOM, hidden). */
58
+ element: Element;
59
+ /** The identifier of the item it is in, when it is in one. */
60
+ itemIdentifier?: string;
61
+ }
62
+ interface PublicItemEventMap {
63
+ 'qc-item-response-changed': CustomEvent<InteractionChangedDetails>;
64
+ /**
65
+ * Request: the item applies these outcomes in one update. Response processing sends it; a host
66
+ * that scores on a backend sends it on the item with the outcomes the backend returned.
67
+ */
68
+ 'qc-item-set-outcomes': CustomEvent<SetOutcomesDetails>;
69
+ /** One per outcome an update applied, with its final value, after the item context is published. */
70
+ 'qc-item-outcome-changed': CustomEvent<OutcomeChangedDetails>;
71
+ /** All the outcomes one update applied, after the item context is published. */
72
+ 'qc-item-outcomes-changed': CustomEvent<OutcomesChangedDetails>;
73
+ /** Cancelable: `preventDefault()` keeps the rubric block where it is. */
74
+ 'qc-item-rubric-placement': CustomEvent<RubricPlacement>;
75
+ /**
76
+ * Cancelable: the feedback element is about to show (its condition turned true). `preventDefault()`
77
+ * keeps it hidden, so the host can show the content itself. Sent once per showing.
78
+ */
79
+ 'qc-feedback-show': CustomEvent<FeedbackEventDetail>;
80
+ /** The condition of a feedback that was shown (or taken over by the host) turned false again. */
81
+ 'qc-feedback-hide': CustomEvent<FeedbackEventDetail>;
82
+ }
83
+ type PublicItemEventName = keyof PublicItemEventMap;
84
+ declare const PUBLIC_ITEM_EVENTS: Record<PublicItemEventName, PublicEventDeclaration>;
85
+ declare global {
86
+ interface HTMLElementEventMap extends PublicItemEventMap {
87
+ }
88
+ }
89
+ /**
90
+ * Dispatch `name` and its deprecated name with the same `detail` object, new name first. Returns
91
+ * `false` when a listener of either cancelled the event. The detail is always an object.
92
+ * Shared by the item and test tiers; use `dispatchPublic` (item) or the test's own wrapper.
93
+ */
94
+ declare function dispatchDeclared(target: EventTarget, declarations: Record<string, PublicEventDeclaration>, name: string, detail: unknown, cancelable?: boolean): boolean;
95
+ /**
96
+ * Listen for `name` and its deprecated name. `dispatchDeclared` sends the old name straight after
97
+ * the new one, synchronously, with the same `detail`: that one is skipped, so the handler runs
98
+ * once. A host that sends only the old name is handled too, and warned once per name in the
99
+ * console: only a sender outside our own components gets here without the new name before it.
100
+ */
101
+ declare function listenDeclared(target: EventTarget, declarations: Record<string, PublicEventDeclaration>, name: string, handler: (e: Event) => void): void;
102
+ declare function dispatchPublic<K extends PublicItemEventName>(target: EventTarget, name: K, detail: PublicItemEventMap[K] extends CustomEvent<infer D> ? D : never, cancelable?: boolean): boolean;
103
+ declare function listenPublic<K extends PublicItemEventName>(target: EventTarget, name: K, handler: (e: PublicItemEventMap[K]) => void): void;
104
+
105
+ export { type FeedbackEventDetail as F, PUBLIC_ITEM_EVENTS as P, type RubricPlacement as R, type PublicEventDeclaration as a, type PublicItemEventMap as b, type PublicItemEventName as c, dispatchDeclared as d, dispatchPublic as e, listenPublic as f, listenDeclared as l };