@citolab/qti-components 6.9.1-beta.10 → 6.9.1-beta.12

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.
@@ -210,38 +210,21 @@ declare global {
210
210
  }
211
211
  }
212
212
 
213
- /**
214
- * @summary qti-choice is used by qti-simple-choice, qti-inline-choice, qti-hottext, qti-hotspot-choice.
215
- *
216
- * @since 1.0
217
- * @status stable
218
- *
219
- * @event qti-register-choice - register itselves on a qti-choice-interaction element.
220
- * @event qti-loose-choice - de-register itselves on a qti-choice-interaction element.
221
- * @event qti-choice-element-selected - Emitted when the choice is selected.
222
- *
223
- * @slot - The choices slot element
224
- */
225
- declare abstract class QtiChoice extends LitElement {
213
+ type Constructor$1<T = {}> = new (...args: any[]) => T;
214
+ interface ChoiceInterface {
226
215
  identifier: string;
227
- tabindex: number | undefined;
228
216
  disabled: boolean;
229
217
  readonly: boolean;
230
- checked: boolean;
231
- handleDisabledChange(_: boolean, disabled: boolean): void;
232
- connectedCallback(): void;
233
- disconnectedCallback(): void;
234
- reset(): void;
235
- private _onKeyUp;
236
- private _onClick;
237
- private _toggleChecked;
238
- render(): lit_html.TemplateResult<1>;
239
- }
240
- declare global {
241
- interface HTMLElementTagNameMap {
242
- 'qti-choice': QtiChoice;
243
- }
244
218
  }
219
+ /**
220
+ * A mixin that adds choice functionality to a LitElement-based class.
221
+ * It dispatches events with a custom `type` and handles selection logic.
222
+ *
223
+ * @param Base - The base class to extend.
224
+ * @param type - The type of the choice, used in event names.
225
+ * @returns A new class extending the base class with choice functionality.
226
+ */
227
+ declare function ActiveElementMixin<T extends Constructor$1<LitElement>>(Base: T, type: string): Constructor$1<ChoiceInterface> & T;
245
228
 
246
229
  /**
247
230
  * @summary The qti-item-body node contains the text, graphics, media objects and interactions that describe the item's content and information about how it is structured.
@@ -474,9 +457,10 @@ declare global {
474
457
  }
475
458
  }
476
459
 
460
+ type Choice = HTMLElement & ChoiceInterface;
477
461
  interface ChoicesInterface {
478
462
  validate(): boolean;
479
- _choiceElements: HTMLElement[];
463
+ _choiceElements: Array<Choice>;
480
464
  correctResponse: string | string[];
481
465
  }
482
466
 
@@ -721,9 +705,9 @@ interface IInteraction {
721
705
  declare const QtiAssociateInteraction_base: (new (...args: any[]) => IInteraction) & typeof LitElement;
722
706
  declare class QtiAssociateInteraction extends QtiAssociateInteraction_base {
723
707
  private _childrenMap;
724
- static styles: lit.CSSResult;
708
+ static styles: CSSResultGroup;
725
709
  render(): lit_html.TemplateResult<1>;
726
- connectedCallback(): void;
710
+ constructor();
727
711
  }
728
712
  declare global {
729
713
  interface HTMLElementTagNameMap {
@@ -865,7 +849,8 @@ declare global {
865
849
  }
866
850
  }
867
851
 
868
- declare class QtiSimpleAssociableChoice extends LitElement {
852
+ declare const QtiSimpleAssociableChoice_base: (new (...args: any[]) => ChoiceInterface) & typeof LitElement;
853
+ declare class QtiSimpleAssociableChoice extends QtiSimpleAssociableChoice_base {
869
854
  static styles: lit.CSSResult;
870
855
  /** the minimal number of selections a candidate must make */
871
856
  matchMin: number;
@@ -883,14 +868,16 @@ declare global {
883
868
 
884
869
  declare const QtiMatchInteraction_base: (new (...args: any[]) => IInteraction) & typeof LitElement;
885
870
  declare class QtiMatchInteraction extends QtiMatchInteraction_base {
886
- static styles: lit.CSSResult[];
871
+ static styles: CSSResultGroup;
887
872
  rows: QtiSimpleAssociableChoice[];
888
873
  cols: QtiSimpleAssociableChoice[];
889
874
  lastCheckedRadio: HTMLInputElement | null;
890
- response: any[];
875
+ _response: string | string[];
876
+ get response(): string[];
877
+ set response(val: string[]);
891
878
  correctOptions: string[];
892
879
  responseIdentifier: string;
893
- connectedCallback(): void;
880
+ connectedCallback(): Promise<void>;
894
881
  handleRadioClick: (e: any) => void;
895
882
  handleRadioChange: (e: any) => void;
896
883
  set correctResponse(responseValue: string | string[]);
@@ -1101,7 +1088,8 @@ declare global {
1101
1088
  }
1102
1089
  }
1103
1090
 
1104
- declare class QtiGapText extends LitElement {
1091
+ declare const QtiGapText_base: (new (...args: any[]) => ChoiceInterface) & typeof LitElement;
1092
+ declare class QtiGapText extends QtiGapText_base {
1105
1093
  static styles: lit.CSSResult;
1106
1094
  tabindex: number | undefined;
1107
1095
  connectedCallback(): void;
@@ -1113,7 +1101,8 @@ declare global {
1113
1101
  }
1114
1102
  }
1115
1103
 
1116
- declare class QtiHotspotChoice extends QtiChoice {
1104
+ declare const QtiHotspotChoice_base: (new (...args: any[]) => ChoiceInterface) & typeof LitElement;
1105
+ declare class QtiHotspotChoice extends QtiHotspotChoice_base {
1117
1106
  static styles: lit.CSSResult;
1118
1107
  order: number;
1119
1108
  }
@@ -1123,7 +1112,8 @@ declare global {
1123
1112
  }
1124
1113
  }
1125
1114
 
1126
- declare class QtiHottext extends QtiChoice {
1115
+ declare const QtiHottext_base: (new (...args: any[]) => ChoiceInterface) & typeof LitElement;
1116
+ declare class QtiHottext extends QtiHottext_base {
1127
1117
  static styles: lit.CSSResult;
1128
1118
  render(): lit_html.TemplateResult<1>;
1129
1119
  }
@@ -1147,19 +1137,12 @@ declare global {
1147
1137
  }
1148
1138
  }
1149
1139
 
1140
+ declare const QtiSimpleChoice_base: (new (...args: any[]) => ChoiceInterface) & typeof LitElement;
1150
1141
  /**
1151
- * @summary Short summary of the component's intended use.
1152
- * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.j9nu1oa1tu3b
1153
- * @status stable
1154
- * @since 4.0
1155
- *
1156
- * @event qti-choice-element-selected - Emitted when a choice is selected.
1157
- * @event qti-register-choice - Emitted when an choice is added
1158
- * @event qti-loose-choice - Emitted when a choice is removed
1159
- *
1160
- * @slot - The default slot.
1142
+ * qti-order-interaction
1143
+ * qti-choice-interaction
1161
1144
  */
1162
- declare class QtiSimpleChoice extends QtiChoice {
1145
+ declare class QtiSimpleChoice extends QtiSimpleChoice_base {
1163
1146
  static styles: lit.CSSResult;
1164
1147
  marker: string;
1165
1148
  render(): lit_html.TemplateResult<1>;
@@ -1170,4 +1153,4 @@ declare global {
1170
1153
  }
1171
1154
  }
1172
1155
 
1173
- export { QtiGapMatchInteraction as $, QtiFeedbackInline as A, type BaseType as B, type Calculate as C, QtiModalFeedback as D, QtiExtendedTextInteraction as E, QtiTextEntryInteraction as F, QtiHottextInteraction as G, QtiInlineChoiceInteraction as H, type ItemContext as I, QtiChoiceInteraction as J, QtiOutcomeProcessing as K, QtiOutcomeProcessingProcessor as L, type Multiple as M, QtiResponseProcessing as N, type OutcomeChangedDetails as O, QtiLookupOutcomeValue as P, QtiRule as Q, type ResponseVariable as R, QtiAnd as S, type MockQtiExpression as T, qtiAndMixin as U, type VariableDeclaration as V, QtiMapping as W, QtiPortableCustomInteraction as X, QtiAssociateInteraction as Y, QtiCustomInteraction as Z, QtiEndAttemptInteraction as _, type QtiRuleBase as a, QtiGraphicAssociateInteraction as a0, QtiGraphicGapMatchInteraction as a1, QtiGraphicOrderInteraction as a2, QtiHotspotInteraction as a3, QtiMatchInteraction as a4, QtiMediaInteraction as a5, QtiOrderInteraction as a6, QtiPositionObjectStage as a7, QtiSelectPointInteraction as a8, QtiSliderInteraction as a9, itemContextVariables as aa, itemContext as ab, QtiCustomOperator as ac, Interaction as ad, QtiAssociableHotspot as ae, QtiGap as af, QtiGapImg as ag, QtiGapText as ah, QtiHotspotChoice as ai, QtiHottext as aj, QtiInlineChoice as ak, QtiSimpleAssociableChoice as al, QtiSimpleChoice as am, type QtiExpressionBase as b, QtiExpression as c, QtiConditionExpression as d, type InteractionChangedDetails as e, type QtiInteractionChanged as f, type QtiOutcomeChanged as g, type directedPair as h, type ResponseInteraction as i, type float as j, type integer as k, type Ordered as l, type Cardinality as m, type VariableValue as n, type OutcomeVariable as o, QtiAssessmentItem as p, QtiAssessmentStimulusRef as q, QtiChoice as r, QtiPrompt as s, QtiStylesheet as t, QtiOutcomeDeclaration as u, QtiResponseDeclaration as v, QtiCompanionMaterialsInfo as w, QtiContentBody as x, QtiRubricBlock as y, QtiFeedbackBlock as z };
1156
+ export { QtiEndAttemptInteraction as $, ActiveElementMixin as A, type BaseType as B, type Calculate as C, QtiFeedbackInline as D, QtiModalFeedback as E, QtiExtendedTextInteraction as F, QtiTextEntryInteraction as G, QtiHottextInteraction as H, type ItemContext as I, QtiInlineChoiceInteraction as J, QtiChoiceInteraction as K, QtiOutcomeProcessing as L, type Multiple as M, QtiOutcomeProcessingProcessor as N, type OutcomeChangedDetails as O, QtiResponseProcessing as P, QtiRule as Q, type ResponseVariable as R, QtiLookupOutcomeValue as S, QtiAnd as T, type MockQtiExpression as U, type VariableDeclaration as V, qtiAndMixin as W, QtiMapping as X, QtiPortableCustomInteraction as Y, QtiAssociateInteraction as Z, QtiCustomInteraction as _, type QtiRuleBase as a, QtiGapMatchInteraction as a0, QtiGraphicAssociateInteraction as a1, QtiGraphicGapMatchInteraction as a2, QtiGraphicOrderInteraction as a3, QtiHotspotInteraction as a4, QtiMatchInteraction as a5, QtiMediaInteraction as a6, QtiOrderInteraction as a7, QtiPositionObjectStage as a8, QtiSelectPointInteraction as a9, QtiSliderInteraction as aa, itemContextVariables as ab, itemContext as ac, QtiCustomOperator as ad, Interaction as ae, QtiAssociableHotspot as af, QtiGap as ag, QtiGapImg as ah, QtiGapText as ai, QtiHotspotChoice as aj, QtiHottext as ak, QtiInlineChoice as al, QtiSimpleAssociableChoice as am, QtiSimpleChoice as an, type QtiExpressionBase as b, QtiExpression as c, QtiConditionExpression as d, type InteractionChangedDetails as e, type QtiInteractionChanged as f, type QtiOutcomeChanged as g, type directedPair as h, type ResponseInteraction as i, type float as j, type integer as k, type Ordered as l, type Cardinality as m, type VariableValue as n, type OutcomeVariable as o, QtiAssessmentItem as p, QtiAssessmentStimulusRef as q, type ChoiceInterface as r, QtiPrompt as s, QtiStylesheet as t, QtiOutcomeDeclaration as u, QtiResponseDeclaration as v, QtiCompanionMaterialsInfo as w, QtiContentBody as x, QtiRubricBlock as y, QtiFeedbackBlock as z };
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "engines": {
22
22
  "node": ">=20.0.0"
23
23
  },
24
- "version": "6.9.1-beta.10",
24
+ "version": "6.9.1-beta.12",
25
25
  "type": "module",
26
26
  "exports": {
27
27
  "./qti-components": "./dist/qti-components/index.js",
@@ -67,7 +67,7 @@
67
67
  "----hooks----": "-",
68
68
  "prepublishOnly": "echo 'calling prepublishOnly as npm lifecycle hook to build-lib!' && npm run build-lib",
69
69
  "postpublish": "echo 'posthook for prosperity, does nothing for now!'",
70
- "test:browser": "vitest",
70
+ "test:browser": "vitest --browser.headless=false",
71
71
  "chromatic": "node chromatic-runner.cjs"
72
72
  },
73
73
  "wireit": {
@@ -87,6 +87,7 @@
87
87
  },
88
88
  "devDependencies": {
89
89
  "@arethetypeswrong/cli": "^0.15.4",
90
+ "@chromatic-com/storybook": "^2.0.2",
90
91
  "@custom-elements-manifest/analyzer": "^0.10.3",
91
92
  "@lit-labs/preact-signals": "^1.0.2",
92
93
  "@lit/context": "^1.1.2",
@@ -130,6 +131,9 @@
130
131
  "prettier": "3.3.3",
131
132
  "remark-gfm": "^4.0.0",
132
133
  "storybook": "^8.3.5",
134
+ "stylelint": "^16.10.0",
135
+ "stylelint-config-standard": "^36.0.1",
136
+ "stylelint-prettier": "^5.0.2",
133
137
  "tsup": "^8.2.4",
134
138
  "tsx": "^4.17.0",
135
139
  "typescript": "^5.5.4",