@citolab/qti-components 6.0.34 → 6.1.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 (42) hide show
  1. package/dist/{chunk-GGEPFBR7.cjs → chunk-6YQCE7H6.cjs} +1 -1
  2. package/dist/chunk-AWSFYZS5.js +17 -0
  3. package/dist/chunk-CCQXZDO6.cjs +17 -0
  4. package/dist/chunk-DKGW23YB.js +1 -0
  5. package/dist/chunk-MTPOYN4D.js +0 -0
  6. package/dist/{chunk-UGSY24LD.cjs → chunk-OI3PY5MR.cjs} +2 -6
  7. package/dist/chunk-TEMU6PXC.cjs +1 -0
  8. package/dist/{chunk-X6JTBTZK.js → chunk-TSUFNGZN.js} +2 -6
  9. package/dist/context/index.cjs +1 -1
  10. package/dist/context/index.d.cts +3 -3
  11. package/dist/context/index.d.ts +3 -3
  12. package/dist/context/index.js +1 -1
  13. package/dist/custom-elements.json +2238 -1210
  14. package/dist/index.cjs +189 -108
  15. package/dist/index.d.cts +194 -63
  16. package/dist/index.d.ts +194 -63
  17. package/dist/index.js +189 -108
  18. package/dist/qti-components/index.cjs +51 -51
  19. package/dist/qti-components/index.d.cts +32 -11
  20. package/dist/qti-components/index.d.ts +32 -11
  21. package/dist/qti-components/index.js +77 -77
  22. package/dist/qti-item/index.cjs +1 -1
  23. package/dist/qti-item/index.d.cts +10 -8
  24. package/dist/qti-item/index.d.ts +10 -8
  25. package/dist/qti-item/index.js +1 -1
  26. package/dist/qti-item-react/index.cjs +1 -1
  27. package/dist/qti-item-react/index.d.cts +2 -1
  28. package/dist/qti-item-react/index.d.ts +2 -1
  29. package/dist/qti-item-react/index.js +1 -1
  30. package/dist/{qti-simple-choice-e2bc67b1.d.ts → qti-simple-choice-5902cb37.d.ts} +45 -48
  31. package/dist/qti-test/index.cjs +79 -0
  32. package/dist/qti-test/index.d.cts +120 -0
  33. package/dist/qti-test/index.d.ts +120 -0
  34. package/dist/qti-test/index.js +79 -0
  35. package/dist/qti-transform/index.cjs +1 -1
  36. package/dist/qti-transform/index.d.cts +1 -0
  37. package/dist/qti-transform/index.d.ts +1 -0
  38. package/dist/qti-transform/index.js +1 -1
  39. package/package.json +36 -30
  40. package/dist/chunk-5GG2XAUT.js +0 -1
  41. package/dist/chunk-G7BJTOY4.cjs +0 -17
  42. package/dist/chunk-UE4QJK43.js +0 -17
package/dist/index.d.cts CHANGED
@@ -26,7 +26,7 @@ type Cardinality = 'multiple' | 'ordered' | 'single';
26
26
  interface OutcomeChangedDetails {
27
27
  item: string;
28
28
  outcomeIdentifier: string;
29
- value: string | string[];
29
+ value: Readonly<string | string[]>;
30
30
  }
31
31
  type InteractionChangedDetails = ResponseInteraction & {
32
32
  item: string;
@@ -76,27 +76,15 @@ interface VariableDeclaration<T> {
76
76
  identifier: string;
77
77
  cardinality: Cardinality;
78
78
  baseType: BaseType;
79
- value: T;
80
- }
81
- interface ResultVariable {
82
- cardinality: Cardinality;
83
- baseType: BaseType;
84
- result: number | boolean | string | (number | boolean | string)[];
79
+ value: Readonly<T>;
80
+ type: 'outcome' | 'response';
85
81
  }
86
- declare class OutcomeVariable implements VariableDeclaration<string | string[] | null> {
87
- identifier: string;
88
- cardinality: Cardinality;
89
- baseType: BaseType;
90
- value: string | string[] | null;
82
+ interface OutcomeVariable extends VariableDeclaration<string | string[] | null> {
91
83
  }
92
- declare class ResponseVariable implements VariableDeclaration<string | string[] | null> {
93
- identifier: string;
94
- cardinality: Cardinality;
95
- baseType: BaseType;
96
- value: string | string[] | null;
97
- candidateResponse: string | string[] | null;
98
- mapping: QtiMapping;
99
- correctResponse: string | string[] | null;
84
+ interface ResponseVariable extends VariableDeclaration<string | string[] | null> {
85
+ candidateResponse?: string | string[] | null;
86
+ mapping?: QtiMapping;
87
+ correctResponse?: string | string[] | null;
100
88
  }
101
89
 
102
90
  type QtiRegisterVariable = CustomEvent<{
@@ -209,6 +197,15 @@ declare const Events: {
209
197
  ON_CHOICE_ELEMENT_SELECTED: string;
210
198
  };
211
199
 
200
+ interface ItemContext {
201
+ href?: string;
202
+ identifier: string;
203
+ variables: ReadonlyArray<VariableDeclaration<string | string[]>>;
204
+ }
205
+ declare const itemContext: {
206
+ __context__: ItemContext;
207
+ };
208
+
212
209
  /**
213
210
  * @summary The qti-assessment-item element contains all the other QTI 3 item structures.
214
211
  * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.dltnnj87l0yj
@@ -226,35 +223,37 @@ declare const Events: {
226
223
  *
227
224
  */
228
225
  declare class QtiAssessmentItem extends LitElement {
229
- variables: VariableDeclaration<string | string[]>[];
230
- private feedbackElements;
231
- private interactionElements;
232
- disabled: boolean;
233
- readonly: boolean;
234
226
  title: string;
235
- identifier: string;
236
- private _numAttempts;
237
- render(): lit_html.TemplateResult<1>;
227
+ identifier: string | undefined;
228
+ adaptive: 'true' | 'false';
229
+ timeDependent: 'true' | 'false';
230
+ disabled: boolean;
238
231
  _handleDisabledChange: (_: boolean, disabled: boolean) => void;
232
+ readonly: boolean;
239
233
  _handleReadonlyChange: (_: boolean, readonly: boolean) => void;
240
- constructor();
234
+ private _context;
235
+ get context(): ItemContext;
236
+ set variables(value: VariableDeclaration<string | string[] | null>[]);
237
+ private _initialContext;
238
+ private _feedbackElements;
239
+ private _interactionElements;
241
240
  firstUpdated(val: any): void;
242
241
  disconnectedCallback(): void;
243
- private _registerVariable;
244
- showCorrectResponse(): void;
245
- processResponse(): boolean;
242
+ /** @deprecated use context property instead */
246
243
  set responses(myResponses: ResponseInteraction[]);
247
- resetInteractions(): void;
248
- validateResponses(): boolean;
249
- getVariable(identifier: string): VariableDeclaration<string | string[] | undefined>;
250
- getResponse(identifier: string): ResponseVariable | null;
251
- getOutcome(identifier: string): OutcomeVariable | null;
252
- private registerFeedbackElement;
253
- private registerInteractionElement;
254
- private interactionResponse;
255
- private outcomeChanged;
256
- private showFeedback;
257
- setOutcomeValue(identifier: string, value: string): void;
244
+ render(): lit_html.TemplateResult<1>;
245
+ constructor();
246
+ showCorrectResponse(): void;
247
+ processResponse(countNumAttempts?: boolean): boolean;
248
+ resetResponses(): void;
249
+ getResponse(identifier: string): Readonly<ResponseVariable>;
250
+ getOutcome(identifier: string): Readonly<OutcomeVariable>;
251
+ getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>>;
252
+ private handleUpdateResponseVariable;
253
+ updateResponseVariable(identifier: string, value: string | string[] | undefined): void;
254
+ updateOutcomeVariable(identifier: string, value: string | string[] | undefined): void;
255
+ private _getCompletionStatus;
256
+ private _emit;
258
257
  }
259
258
  declare global {
260
259
  interface HTMLElementTagNameMap {
@@ -353,7 +352,7 @@ declare class QtiOutcomeDeclaration extends QtiVariableDeclaration {
353
352
  declare class QtiCompanionMaterialsInfo extends LitElement {
354
353
  }
355
354
 
356
- interface Audience {
355
+ interface AudienceContext {
357
356
  view: 'author' | 'candidate' | 'proctor' | 'scorer' | 'testConstructor' | 'tutor';
358
357
  }
359
358
 
@@ -365,7 +364,7 @@ declare class qtiRubricBlock extends LitElement {
365
364
  handleclassNamesChange(old: any, disabled: boolean): void;
366
365
  static styles: lit.CSSResult;
367
366
  logger: ContextConsumer<{
368
- __context__: Audience;
367
+ __context__: AudienceContext;
369
368
  }, this>;
370
369
  render(): lit_html.TemplateResult<1>;
371
370
  connectedCallback(): void;
@@ -377,10 +376,9 @@ declare class qtiContentBody extends LitElement {
377
376
 
378
377
  declare abstract class QtiFeedback extends LitElement {
379
378
  protected showHide: string;
380
- protected outcomeIdentifier: string;
379
+ outcomeIdentifier: string;
381
380
  protected identifier: string;
382
381
  protected showStatus: string;
383
- constructor();
384
382
  connectedCallback(): void;
385
383
  checkShowFeedback(outcomeIdentifier: string): void;
386
384
  private showFeedback;
@@ -408,9 +406,8 @@ declare abstract class Interaction extends LitElement {
408
406
  disabled: boolean;
409
407
  /** readonly should be exposed to the attributes and accessible as property */
410
408
  readonly: boolean;
411
- abstract reset(): void;
412
409
  abstract validate(): boolean;
413
- abstract set response(val: string | string[]);
410
+ abstract set response(val: Readonly<string | string[]>);
414
411
  connectedCallback(): void;
415
412
  saveResponse(value: string | string[]): void;
416
413
  }
@@ -472,9 +469,8 @@ declare abstract class Choices extends Interaction {
472
469
  _handleReadonlyChange: (_: boolean, readonly: boolean) => void;
473
470
  _handleMaxChoicesChange: () => void;
474
471
  constructor();
475
- reset(): void;
476
472
  validate(): boolean;
477
- set response(myResponse: ResponseType);
473
+ set response(responseValue: string | string[]);
478
474
  connectedCallback(): void;
479
475
  disconnectedCallback(): void;
480
476
  private _registerChoiceElement;
@@ -595,7 +591,7 @@ declare abstract class QtiExpression<T> extends LitElement {
595
591
  protected set error(val: string);
596
592
  static styles: lit.CSSResult;
597
593
  render(): lit_html.TemplateResult<1>;
598
- calculate(): T;
594
+ calculate(): Readonly<T>;
599
595
  protected get assessmentItem(): QtiAssessmentItem;
600
596
  protected getVariables: () => VariableDeclaration<number | string | (number | string)[] | null>[];
601
597
  }
@@ -690,7 +686,7 @@ declare class QtPrintedVariable extends LitElement {
690
686
  value: string | string[];
691
687
  render(): lit_html.TemplateResult<1>;
692
688
  constructor();
693
- calculate(): string | string[];
689
+ calculate(): Readonly<string | string[]>;
694
690
  }
695
691
 
696
692
  declare class QtiProduct extends QtiExpression<number> {
@@ -698,7 +694,7 @@ declare class QtiProduct extends QtiExpression<number> {
698
694
  }
699
695
 
700
696
  declare class QtiVariable extends QtiExpression<string | string[]> {
701
- calculate(): string | string[];
697
+ calculate(): Readonly<string | string[]>;
702
698
  }
703
699
 
704
700
  declare class QtiStringMatch extends QtiExpression<boolean> {
@@ -955,8 +951,11 @@ declare class QtiSliderInteraction extends Interaction {
955
951
  private getPositionFromEvent;
956
952
  }
957
953
 
958
- declare class QtiEndAttemptInteraction extends LitElement {
954
+ declare class QtiEndAttemptInteraction extends Interaction {
955
+ countAttempt: string;
959
956
  title: 'end attempt';
957
+ validate(): boolean;
958
+ set response(val: undefined);
960
959
  render(): lit_html.TemplateResult<1>;
961
960
  endAttempt(e: Event): void;
962
961
  }
@@ -1022,16 +1021,35 @@ declare global {
1022
1021
  }
1023
1022
  }
1024
1023
 
1024
+ /**
1025
+ * https://www.imsglobal.org/spec/qti/v3p0/impl#h.fi29q8dubjgw
1026
+ * <qti-custom-operator class="js.org">
1027
+ <qti-base-value base-type="string"><![CDATA[
1028
+ console.log(context.variables);
1029
+ return 'B'
1030
+ document.querySelector('qti-end-attempt-interaction').disabled = true;
1031
+ ]]></qti-base-value>
1032
+ </qti-custom-operator>
1033
+ </qti-set-outcome-value>
1034
+ */
1035
+ declare class QtiCustomOperator extends LitElement implements Calculate {
1036
+ private operatorFunction;
1037
+ context?: ItemContext;
1038
+ render(): lit_html.TemplateResult<1>;
1039
+ handleSlotChange(event: Event): void;
1040
+ calculate(): any;
1041
+ }
1042
+
1025
1043
  declare class QtiItem extends LitElement {
1026
1044
  itemLocation: string;
1027
- set audienceContext(context: {
1028
- view: 'author' | 'candidate' | 'proctor' | 'scorer' | 'testConstructor' | 'tutor';
1029
- });
1030
- private provider;
1031
- private _xml;
1045
+ disabled: boolean;
1046
+ update(changedProperties: Map<string | number | symbol, unknown>): void;
1047
+ protected _xml: string;
1032
1048
  set xml(val: string);
1033
- get xml(): string;
1034
- static styles: lit.CSSResult;
1049
+ set css(val: string);
1050
+ get assessmentItem(): QtiAssessmentItem | null;
1051
+ audienceContext: AudienceContext;
1052
+ constructor();
1035
1053
  connectedCallback(): void;
1036
1054
  render: () => lit_html.TemplateResult<1>;
1037
1055
  }
@@ -1039,6 +1057,7 @@ declare class QtiItem extends LitElement {
1039
1057
  declare const qtiTransform: (xmlValue: string) => {
1040
1058
  mathml(): any;
1041
1059
  removeNamesSpaces(): any;
1060
+ cDataToComment(): any;
1042
1061
  pciHooks(uri: string): any;
1043
1062
  assetsLocation(uri: string, attributes?: string[]): any;
1044
1063
  customTypes(): any;
@@ -1051,4 +1070,116 @@ declare const qtiTransform: (xmlValue: string) => {
1051
1070
  xml(): string;
1052
1071
  };
1053
1072
 
1054
- export { BaseType, Calculate, Cardinality, Events, Interaction, InteractionChangedDetails, Multiple, Ordered, OutcomeChangedDetails, OutcomeVariable, QtPrintedVariable, QtiAnd, QtiAssessmentItem, QtiAssociableHotspot, QtiAssociateInteraction, QtiBaseValue, QtiChoice, qtiChoiceElementSelected as QtiChoiceElementSelected, QtiChoiceInteraction, QtiCompanionMaterialsInfo, QtiConditionExpression, QtiContains, QtiCorrect, QtiEndAttemptInteraction, QtiEqual, QtiEqualRounded, QtiExpression, QtiExtendedTextInteraction, QtiFeedbackBlock, QtiFeedbackInline, QtiGap, QtiGapImg, QtiGapMatchInteraction, QtiGapText, QtiGraphicAssociateInteraction, QtiGraphicGapMatchInteraction, QtiGraphicOrderInteraction, QtiGt, QtiGte, QtiHotspotChoice, QtiHotspotInteraction, QtiHottext, QtiHottextInteraction, QtiInlineChoice, QtiInlineChoiceInteraction, qtiInteractionChanged as QtiInteractionChanged, qtiInteractionResponse as QtiInteractionResponse, QtiIsNull, QtiItem, qtiLooseChoice as QtiLooseChoice, QtiLt, QtiLte, QtiMapResponse, QtiMapping, QtiMatch, QtiMatchInteraction, QtiMediaInteraction, QtiMember, QtiModalFeedback, QtiMultiple, QtiNot, QtiOr, QtiOrderInteraction, QtiOrdered, qtiOutcomeChanged as QtiOutcomeChanged, QtiOutcomeDeclaration, QtiPortableCustomInteraction, QtiPositionObjectStage, QtiProduct, QtiPrompt, qtiRegisterChoice as QtiRegisterChoice, qtiRegisterHotspot as QtiRegisterHotspot, qtiRegisterInteraction as QtiRegisterInteraction, qtiRegisterVariable as QtiRegisterVariable, QtiResponseCondition, QtiResponseDeclaration, QtiResponseElse, QtiResponseElseIf, QtiResponseIf, QtiResponseProcessing, QtiRule, QtiSPositionObjectInteraction, QtiSelectPointInteraction, QtiSetOutcomeValue, QtiSimpleAssociableChoice, QtiSimpleChoice, QtiSliderInteraction, QtiStringMatch, QtiStylesheet, QtiSum, QtiTextEntryInteraction, QtiVariable, ResponseInteraction, ResponseVariable, ResultVariable, VariableDeclaration, directedPair, float, integer, qtiContentBody, qtiRubricBlock, qtiTransform };
1073
+ declare class QtiAssessmentItemRef extends QtiItem {
1074
+ identifier: string;
1075
+ href: string;
1076
+ connectedCallback(): void;
1077
+ }
1078
+
1079
+ interface ItemInfo {
1080
+ href: string;
1081
+ }
1082
+ interface TestContext {
1083
+ itemIndex: number | null;
1084
+ items: (ItemContext & ItemInfo)[];
1085
+ }
1086
+
1087
+ declare class QtiAssessmentTest extends LitElement {
1088
+ context: TestContext;
1089
+ itemRefEls: Map<string, QtiAssessmentItemRef>;
1090
+ private copyItemVariables;
1091
+ getAssessmentItem(identifier: string): QtiAssessmentItem;
1092
+ private onItemRefRegistered;
1093
+ private onTestRequestItem;
1094
+ firstUpdated(a: any): void;
1095
+ constructor();
1096
+ private itemConnected;
1097
+ private _requestItem;
1098
+ render(): lit_html.TemplateResult<1>;
1099
+ }
1100
+
1101
+ declare class QtiTestPart extends LitElement {
1102
+ private _navigationMode;
1103
+ render(): lit_html.TemplateResult<1>;
1104
+ }
1105
+
1106
+ declare class QtiTest extends LitElement {
1107
+ private _navigationMode;
1108
+ private assessmentTestURI;
1109
+ loadedItems: any[];
1110
+ itemRefEls: {
1111
+ current: Map<string, QtiAssessmentItemRef>;
1112
+ };
1113
+ controller: AbortController;
1114
+ requestItem(identifier: string): void;
1115
+ render(): lit_html.TemplateResult<1>;
1116
+ }
1117
+
1118
+ declare class TestNext extends LitElement {
1119
+ _testContext?: TestContext;
1120
+ _requestItem(index: any): void;
1121
+ render(): lit_html.TemplateResult<1>;
1122
+ }
1123
+
1124
+ declare class TestPrev extends LitElement {
1125
+ _testContext?: TestContext;
1126
+ _requestItem(index: any): void;
1127
+ render(): lit_html.TemplateResult<1>;
1128
+ }
1129
+
1130
+ declare class QtiTestProgress extends LitElement {
1131
+ _testProvider?: TestContext;
1132
+ render(): lit_html.TemplateResult<1>;
1133
+ }
1134
+
1135
+ declare class QtiTestSlider extends LitElement {
1136
+ _testProvider?: TestContext;
1137
+ _requestItem(index: any): void;
1138
+ render(): lit_html.TemplateResult<1>;
1139
+ }
1140
+
1141
+ declare class QtiTestPagingRadio extends LitElement {
1142
+ _testProvider?: TestContext;
1143
+ protected createRenderRoot(): Element | ShadowRoot;
1144
+ _requestItem(index: any): void;
1145
+ render(): lit_html.TemplateResult<1>;
1146
+ }
1147
+
1148
+ declare class QtiTestPagingButtons extends LitElement {
1149
+ _testProvider?: TestContext;
1150
+ protected createRenderRoot(): Element | ShadowRoot;
1151
+ _requestItem(index: any): void;
1152
+ render(): lit_html.TemplateResult<1>;
1153
+ }
1154
+
1155
+ declare class QtiTestShowCorrect extends LitElement {
1156
+ _testProvider?: TestContext;
1157
+ render(): lit_html.TemplateResult<1>;
1158
+ }
1159
+
1160
+ declare class TestScript extends LitElement {
1161
+ private operatorFunction;
1162
+ private _context;
1163
+ private _printed;
1164
+ render(): lit_html.TemplateResult<1>;
1165
+ handleSlotChange(event: Event): void;
1166
+ }
1167
+
1168
+ declare class TestShowIndex extends LitElement {
1169
+ _testContext?: TestContext;
1170
+ _requestItem(index: any): void;
1171
+ render(): lit_html.TemplateResult<1>;
1172
+ }
1173
+
1174
+ declare class QtiPrintVariables extends LitElement {
1175
+ _testProvider?: TestContext;
1176
+ render(): lit_html.TemplateResult<1>;
1177
+ }
1178
+
1179
+ declare class QtiTestPrintScore extends LitElement {
1180
+ _testContext?: TestContext;
1181
+ _requestItem(index: any): void;
1182
+ render(): lit_html.TemplateResult<1>;
1183
+ }
1184
+
1185
+ export { BaseType, Calculate, Cardinality, Events, Interaction, InteractionChangedDetails, ItemContext, Multiple, Ordered, OutcomeChangedDetails, OutcomeVariable, QtPrintedVariable, QtiAnd, QtiAssessmentItem, QtiAssessmentItemRef, QtiAssessmentTest, QtiAssociableHotspot, QtiAssociateInteraction, QtiBaseValue, QtiChoice, qtiChoiceElementSelected as QtiChoiceElementSelected, QtiChoiceInteraction, QtiCompanionMaterialsInfo, QtiConditionExpression, QtiContains, QtiCorrect, QtiCustomOperator, QtiEndAttemptInteraction, QtiEqual, QtiEqualRounded, QtiExpression, QtiExtendedTextInteraction, QtiFeedbackBlock, QtiFeedbackInline, QtiGap, QtiGapImg, QtiGapMatchInteraction, QtiGapText, QtiGraphicAssociateInteraction, QtiGraphicGapMatchInteraction, QtiGraphicOrderInteraction, QtiGt, QtiGte, QtiHotspotChoice, QtiHotspotInteraction, QtiHottext, QtiHottextInteraction, QtiInlineChoice, QtiInlineChoiceInteraction, qtiInteractionChanged as QtiInteractionChanged, qtiInteractionResponse as QtiInteractionResponse, QtiIsNull, QtiItem, qtiLooseChoice as QtiLooseChoice, QtiLt, QtiLte, QtiMapResponse, QtiMapping, QtiMatch, QtiMatchInteraction, QtiMediaInteraction, QtiMember, QtiModalFeedback, QtiMultiple, QtiNot, QtiOr, QtiOrderInteraction, QtiOrdered, qtiOutcomeChanged as QtiOutcomeChanged, QtiOutcomeDeclaration, QtiPortableCustomInteraction, QtiPositionObjectStage, QtiPrintVariables, QtiProduct, QtiPrompt, qtiRegisterChoice as QtiRegisterChoice, qtiRegisterHotspot as QtiRegisterHotspot, qtiRegisterInteraction as QtiRegisterInteraction, qtiRegisterVariable as QtiRegisterVariable, QtiResponseCondition, QtiResponseDeclaration, QtiResponseElse, QtiResponseElseIf, QtiResponseIf, QtiResponseProcessing, QtiRule, QtiSPositionObjectInteraction, QtiSelectPointInteraction, QtiSetOutcomeValue, QtiSimpleAssociableChoice, QtiSimpleChoice, QtiSliderInteraction, QtiStringMatch, QtiStylesheet, QtiSum, QtiTest, QtiTestPagingButtons, QtiTestPagingRadio, QtiTestPart, QtiTestPrintScore, QtiTestProgress, QtiTestShowCorrect, QtiTestSlider, QtiTextEntryInteraction, QtiVariable, ResponseInteraction, ResponseVariable, TestNext, TestPrev, TestScript, TestShowIndex, VariableDeclaration, directedPair, float, integer, itemContext, qtiContentBody, qtiRubricBlock, qtiTransform };