@citolab/qti-components 7.0.2 → 7.0.3

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.
package/dist/item.css CHANGED
@@ -2346,20 +2346,6 @@ qti-response-declaration {
2346
2346
 
2347
2347
  & qti-gap {
2348
2348
 
2349
- &[enabled] {
2350
-
2351
- /* Light theme override */
2352
- .qti-selections-light & {
2353
- border-color: var(--qti-light-border-active);
2354
- }
2355
-
2356
- /* Dark theme override */
2357
- .qti-selections-dark & {
2358
- border-color: var(--qti-dark-border-active);
2359
- }
2360
- background-color: var(--qti-bg-active)
2361
- }
2362
-
2363
2349
  &[disabled] {
2364
2350
 
2365
2351
  &:not(:empty) {
@@ -2377,6 +2363,20 @@ qti-response-declaration {
2377
2363
  outline: 4px solid var(--qti-disabled-bg)
2378
2364
  }
2379
2365
 
2366
+ &[enabled] {
2367
+
2368
+ /* Light theme override */
2369
+ .qti-selections-light & {
2370
+ border-color: var(--qti-light-border-active);
2371
+ }
2372
+
2373
+ /* Dark theme override */
2374
+ .qti-selections-dark & {
2375
+ border-color: var(--qti-dark-border-active);
2376
+ }
2377
+ background-color: var(--qti-bg-active)
2378
+ }
2379
+
2380
2380
  &[active] {
2381
2381
 
2382
2382
  /* Light theme override */
@@ -2759,12 +2759,22 @@ qti-response-declaration {
2759
2759
  }
2760
2760
 
2761
2761
  qti-match-interaction:not(.qti-match-tabular) {
2762
+ &:state(--dragzone-enabled) qti-simple-match-set:first-of-type {
2763
+ background-color: var(--qti-bg-active);
2764
+ }
2765
+
2766
+ &:state(--dragzone-active) qti-simple-match-set:first-of-type {
2767
+ border-color: var(--qti-border-active);
2768
+ background-color: var(--qti-bg-active);
2769
+ }
2770
+
2762
2771
  /* The draggables */
2763
2772
  & qti-simple-match-set:first-of-type {
2764
2773
  display: flex;
2765
2774
  flex-wrap: wrap;
2766
2775
  align-items: flex-start; /* Prevents children from stretching */
2767
2776
  gap: var(--qti-gap-size);
2777
+ border: 2px solid transparent;
2768
2778
 
2769
2779
  & qti-simple-associable-choice {
2770
2780
 
@@ -3156,6 +3166,16 @@ qti-response-declaration {
3156
3166
  }
3157
3167
 
3158
3168
  qti-associate-interaction {
3169
+ /* General styles for active and enabled states */
3170
+ &:state(--dragzone-active) slot[name='qti-simple-associable-choice'] {
3171
+ border-color: var(--qti-border-active);
3172
+ background-color: var(--qti-bg-active);
3173
+ }
3174
+
3175
+ &:state(--dragzone-enabled) slot[name='qti-simple-associable-choice'] {
3176
+ background-color: var(--qti-bg-active);
3177
+ }
3178
+
3159
3179
  & qti-simple-associable-choice, /* drags when in lightdom */
3160
3180
  &::part(qti-simple-associable-choice) /* drags when in shadowdom */ {
3161
3181
 
@@ -1,4 +1,4 @@
1
- import { e as QtiAssessmentItem } from '../qti-simple-choice-DG8ImdPz.js';
1
+ import { e as QtiAssessmentItem } from '../qti-simple-choice-UTrFa_RQ.js';
2
2
  import 'lit-html';
3
3
  import 'lit';
4
4
  import 'lit-html/directives/ref.js';
@@ -563,10 +563,6 @@ export type QtiAssociateInteractionProps = {
563
563
  /** */
564
564
  readonly?: boolean;
565
565
  /** */
566
- dragDropApi?: TouchDragAndDrop;
567
- /** */
568
- configuration?: InteractionConfiguration;
569
- /** */
570
566
  value?: string | string[];
571
567
  /** */
572
568
  correctResponse?: string | string[];
@@ -644,10 +640,6 @@ export type QtiGapMatchInteractionProps = {
644
640
  /** */
645
641
  correctResponse?: string | string[];
646
642
  /** */
647
- dragDropApi?: TouchDragAndDrop;
648
- /** */
649
- configuration?: InteractionConfiguration;
650
- /** */
651
643
  value?: string | string[];
652
644
  /** */
653
645
  "onqti-register-interaction"?: (e: CustomEvent<CustomEvent>) => void;
@@ -721,10 +713,6 @@ export type QtiGraphicGapMatchInteractionProps = {
721
713
  /** */
722
714
  readonly?: boolean;
723
715
  /** */
724
- dragDropApi?: TouchDragAndDrop;
725
- /** */
726
- configuration?: InteractionConfiguration;
727
- /** */
728
716
  value?: string | string[];
729
717
  /** */
730
718
  correctResponse?: string | string[];
@@ -779,6 +767,8 @@ export type QtiHotspotInteractionProps = {
779
767
  };
780
768
 
781
769
  export type QtiMatchInteractionProps = {
770
+ /** */
771
+ class?: string;
782
772
  /** */
783
773
  "response-identifier"?: string;
784
774
  /** */
@@ -790,28 +780,10 @@ export type QtiMatchInteractionProps = {
790
780
  /** */
791
781
  readonly?: boolean;
792
782
  /** */
793
- rows?: QtiSimpleAssociableChoice[];
794
- /** */
795
- cols?: QtiSimpleAssociableChoice[];
796
- /** */
797
- lastCheckedRadio?: HTMLInputElement | null;
798
- /** */
799
- _response?: string | string[];
800
- /** */
801
783
  value?: string | string[];
802
784
  /** */
803
- correctOptions?: string[];
804
- /** */
805
- handleRadioClick?: string;
806
- /** */
807
- handleRadioChange?: string;
808
- /** */
809
785
  correctResponse?: string | string[];
810
786
  /** */
811
- dragDropApi?: TouchDragAndDrop;
812
- /** */
813
- configuration?: InteractionConfiguration;
814
- /** */
815
787
  "onqti-register-interaction"?: (e: CustomEvent<CustomEvent>) => void;
816
788
  /** */
817
789
  "onqti-interaction-response"?: (e: CustomEvent<CustomEvent>) => void;
@@ -860,10 +832,6 @@ export type QtiOrderInteractionProps = {
860
832
  /** */
861
833
  correctResponse?: string | string[];
862
834
  /** */
863
- dragDropApi?: TouchDragAndDrop;
864
- /** */
865
- configuration?: InteractionConfiguration;
866
- /** */
867
835
  value?: string | string[];
868
836
  /** */
869
837
  "onqti-register-interaction"?: (e: CustomEvent<CustomEvent>) => void;
@@ -1135,7 +1103,7 @@ export type QtiTestPartProps = {
1135
1103
  };
1136
1104
 
1137
1105
  export type QtiTestProps = {
1138
- /** the relative location to the QTI assessment.xml file */
1106
+ /** the relative location to the QTI assessment.xml file ### Features - **Dynamic Template Loading**: If a `<template>` element is included as a child of `<qti-test>`, its content is dynamically appended to the shadow DOM. */
1139
1107
  testURL?: string;
1140
1108
  /** */
1141
1109
  context?: TestContext;
@@ -2087,7 +2055,7 @@ export type CustomElements = {
2087
2055
  * ---
2088
2056
  *
2089
2057
  */
2090
- "qti-player": Partial<QtiTestProps & BaseProps & BaseEvents>;
2058
+ "qti-test": Partial<QtiTestProps & BaseProps & BaseEvents>;
2091
2059
 
2092
2060
  /**
2093
2061
  * Represents a custom element for navigating to the next test item.
@@ -1,6 +1,6 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
- import { LitElement, CSSResultGroup, PropertyValueMap, PropertyValues } from 'lit';
3
+ import { LitElement, CSSResultGroup, PropertyValueMap } from 'lit';
4
4
  import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
5
5
 
6
6
  interface directedPair {
@@ -776,13 +776,8 @@ declare global {
776
776
 
777
777
  declare const QtiGapMatchInteraction_base: (abstract new (...args: any[]) => IInteraction) & typeof Interaction;
778
778
  declare class QtiGapMatchInteraction extends QtiGapMatchInteraction_base {
779
- private observer;
780
- private resizeObserver;
781
779
  static styles: CSSResultGroup;
782
780
  render(): lit_html.TemplateResult<1>;
783
- firstUpdated(_changedProperties: PropertyValues): void;
784
- disconnectedCallback(): void;
785
- private updateMinDimensionsForDrowZones;
786
781
  set correctResponse(value: string | string[]);
787
782
  }
788
783
  declare global {
@@ -828,11 +823,7 @@ declare global {
828
823
  declare const QtiGraphicGapMatchInteraction_base: (abstract new (...args: any[]) => IInteraction) & typeof Interaction;
829
824
  declare class QtiGraphicGapMatchInteraction extends QtiGraphicGapMatchInteraction_base {
830
825
  static styles: CSSResultGroup;
831
- private observer;
832
- private resizeObserver;
833
826
  render(): lit_html.TemplateResult<1>;
834
- firstUpdated(_changedProperties: PropertyValues): void;
835
- private updateMinDimensionsForDrowZones;
836
827
  private positionHotspotOnRegister;
837
828
  connectedCallback(): void;
838
829
  disconnectedCallback(): void;
@@ -894,17 +885,18 @@ declare global {
894
885
  declare const QtiMatchInteraction_base: (abstract new (...args: any[]) => IInteraction) & typeof Interaction;
895
886
  declare class QtiMatchInteraction extends QtiMatchInteraction_base {
896
887
  static styles: CSSResultGroup;
897
- rows: QtiSimpleAssociableChoice[];
898
- cols: QtiSimpleAssociableChoice[];
899
- lastCheckedRadio: HTMLInputElement | null;
900
- _response: string | string[];
888
+ protected rows: QtiSimpleAssociableChoice[];
889
+ protected cols: QtiSimpleAssociableChoice[];
890
+ protected lastCheckedRadio: HTMLInputElement | null;
891
+ class: string;
892
+ protected _response: string | string[];
901
893
  get value(): string[];
902
894
  set value(val: string[]);
903
- correctOptions: string[];
904
895
  responseIdentifier: string;
896
+ protected correctOptions: string[];
905
897
  connectedCallback(): Promise<void>;
906
- handleRadioClick: (e: any) => void;
907
- handleRadioChange: (e: any) => void;
898
+ protected handleRadioClick: (e: any) => void;
899
+ protected handleRadioChange: (e: any) => void;
908
900
  set correctResponse(responseValue: string | string[]);
909
901
  render(): lit_html.TemplateResult<1>;
910
902
  }
@@ -619,6 +619,7 @@
619
619
  "name": "qti-match-interaction",
620
620
  "description": "\n---\n\n\n### **Events:**\n - **qti-register-interaction**\n- **qti-interaction-response**",
621
621
  "attributes": [
622
+ { "name": "class", "values": [] },
622
623
  { "name": "response-identifier", "values": [] },
623
624
  { "name": "min-associations", "values": [] },
624
625
  { "name": "max-associations", "values": [] },
@@ -851,12 +852,12 @@
851
852
  "references": []
852
853
  },
853
854
  {
854
- "name": "qti-player",
855
+ "name": "qti-test",
855
856
  "description": "`<qti-test>` is a custom element designed for rendering and interacting with QTI (Question and Test Interoperability) tests.\n\nThis component leverages several mixins to provide functionality for loading, navigating, processing, and displaying QTI test assessments.\n\n### Example Usage\n\nMinimal markup:\n```html\n<qti-test test=\"./path/to/assessment.xml\">\n <test-container></test-container>\n</qti-test>\n```\n\nWith navigation buttons:\n```html\n<qti-test >\n <test-container test-url=\"./path/to/assessment.xml\"></test-container>\n <div class=\"flex\">\n <test-prev></test-prev>\n <test-next></test-next>\n </div>\n</qti-test>\n```\n\nYou can use normal class names to style the elements.\nAnd you can use the `test-prev` and `test-next` elements to navigate through the test.\n---\n",
856
857
  "attributes": [
857
858
  {
858
859
  "name": "testURL",
859
- "description": "the relative location to the QTI assessment.xml file",
860
+ "description": "the relative location to the QTI assessment.xml file ### Features - **Dynamic Template Loading**: If a `<template>` element is included as a child of `<qti-test>`, its content is dynamically appended to the shadow DOM.",
860
861
  "values": []
861
862
  }
862
863
  ],
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "engines": {
22
22
  "node": ">=20.0.0"
23
23
  },
24
- "version": "7.0.2",
24
+ "version": "7.0.3",
25
25
  "main": "dist/index.js",
26
26
  "type": "module",
27
27
  "exports": {
@@ -36,7 +36,8 @@
36
36
  },
37
37
  "./item.css": "./dist/item.css",
38
38
  "./cdn/index.js": "./cdn/index.js",
39
- "./cdn/index.global.js": "./cdn/index.global.js"
39
+ "./cdn/index.global.js": "./cdn/index.global.js",
40
+ "./react": "./dist//qti-components-jsx.d.ts"
40
41
  },
41
42
  "types": "./dist/qti-components/index.d.ts",
42
43
  "typesVersions": {
@@ -98,7 +99,8 @@
98
99
  "files": [
99
100
  "src/**/*.{ts}",
100
101
  "tsconfig.json",
101
- "!src/**/*.{test,spec,stories}.ts"
102
+ "!src/**/*.{test,spec,stories}.ts",
103
+ "package.json"
102
104
  ]
103
105
  },
104
106
  "cem": {
@@ -232,7 +234,7 @@
232
234
  "optionalDependencies": {
233
235
  "@rollup/rollup-linux-x64-gnu": "^4.28.1"
234
236
  },
235
- "customElements": "dist/custom-elements.json",
237
+ "customElements": "custom-elements.json",
236
238
  "bugs": {
237
239
  "url": "https://github.com/Citolab/qti-components/issues"
238
240
  },
package/readme.md ADDED
@@ -0,0 +1,55 @@
1
+ # @citolab/qti-components
2
+
3
+ <a href="https://www.repostatus.org/#wip"><img src="https://www.repostatus.org/badges/latest/wip.svg" alt="Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public." /></a>
4
+
5
+ [![npm version](https://badge.fury.io/js/%40citolab%2Fqti-components.svg)](https://badge.fury.io/js/%40citolab%2Fqti-components)
6
+ [![License](https://img.shields.io/badge/license-GPL-blue.svg)](https://opensource.org/license/gpl-2-0/)
7
+
8
+ @citolab/qti-components is a web component library that can be used to render 1EdTech QTI items.
9
+ It's highly customizable and can be integrated in almost every web application.
10
+
11
+ ## Installation
12
+
13
+ ### CDN
14
+
15
+ Import the components with the CDN version
16
+
17
+ ```html
18
+ <script type="module">
19
+ import 'https://unpkg.com/@citolab/qti-components/cdn';
20
+ </script>
21
+ ```
22
+
23
+ ### NPM
24
+
25
+ Or use npm to install the package:
26
+
27
+ ```shell
28
+ npm install @citolab/qti-components
29
+ ```
30
+
31
+ To use @citolab/qti-components, you need to register the web components. By registering the web components, the browser knows how to display the item and create a fully functional test.
32
+
33
+ ```javascript
34
+ import '@citolab/qti-components';
35
+ ```
36
+
37
+ ## Storybook
38
+
39
+ Explore the complete description of supported QTI tags, examples, and the ability to interactively play with changing attributes of the QTI items in our [Storybook](https://qti-components.citolab.nl/).
40
+
41
+ ## Contributing
42
+
43
+ Contributions are welcome! Please follow these guidelines when contributing:
44
+
45
+ - Fork the repository and clone it to your local machine
46
+ - Create a new branch for your feature or bug fix
47
+ - Commit your changes with clear and concise messages
48
+ - Push your changes to your forked repository
49
+ - Open a pull request to the original repository
50
+
51
+ ## License
52
+
53
+ This project is licensed under the [GPLv3 License](LICENSE).
54
+
55
+ Please note that the licensing is GPLv3 if you want to use it in another way, feel free to ask!
package/README.md DELETED
@@ -1,85 +0,0 @@
1
- # @citolab/qti-components
2
-
3
- <a href="https://www.repostatus.org/#wip"><img src="https://www.repostatus.org/badges/latest/wip.svg" alt="Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public." /></a>
4
-
5
- [![npm version](https://badge.fury.io/js/%40citolab%2Fqti-components.svg)](https://badge.fury.io/js/%40citolab%2Fqti-components)
6
- [![License](https://img.shields.io/badge/license-GPL-blue.svg)](https://opensource.org/license/gpl-2-0/)
7
-
8
- @citolab/qti-components is a web component library that can be used to render 1EdTech QTI items.
9
- It's highly customizable and can be integrated in almost every web application.
10
-
11
- ## Installation
12
-
13
- Use npm to install the package:
14
-
15
- ```shell
16
- npm install @citolab/qti-components
17
- ```
18
-
19
- ## Usage
20
-
21
- To use @citolab/qti-components, you need to register the web components and import the required CSS file. By registering the web components, the browser knows how to display the item and create a fully functional item.
22
-
23
- Here's a basic example:
24
-
25
- ```javascript
26
- import * as QTI from 'https://unpkg.com/@citolab/qti-components@latest/dist/index.js';
27
- ```
28
-
29
- ```css
30
- @import 'https://unpkg.com/@citolab/qti-components@latest/dist/index.css';'
31
- ```
32
-
33
- ```html
34
- <qti-assessment-item identifier="choice" title="Unattended Luggage" adaptive="false" time-dependent="false">
35
- <qti-response-declaration identifier="RESPONSE" cardinality="single" base-type="identifier">
36
- <qti-correct-response>
37
- <qti-value>ChoiceA</qti-value>
38
- </qti-correct-response>
39
- </qti-response-declaration>
40
- <qti-outcome-declaration identifier="SCORE" cardinality="single" base-type="float">
41
- <qti-default-value>
42
- <qti-value>0</qti-value>
43
- </qti-default-value>
44
- </qti-outcome-declaration>
45
- <qti-item-body>
46
- <p>Look at the text in the picture.</p>
47
- <p>
48
- <img src="images/sign.png" alt="NEVER LEAVE LUGGAGE UNATTENDED" />
49
- </p>
50
- <qti-choice-interaction response-identifier="RESPONSE" shuffle="false" max-choices="1">
51
- <qti-prompt>What does it say?</qti-prompt>
52
- <qti-simple-choice identifier="ChoiceA">You must stay with your luggage at all times.</qti-simple-choice>
53
- <qti-simple-choice identifier="ChoiceB">Do not let someone else look after your luggage.</qti-simple-choice>
54
- <qti-simple-choice identifier="ChoiceC">Remember your luggage when you leave.</qti-simple-choice>
55
- </qti-choice-interaction>
56
- </qti-item-body>
57
- <qti-response-processing template="https://purl.imsglobal.org/spec/qti/v3p0/rptemplates/match_correct.xml" />
58
- </qti-assessment-item>
59
- ```
60
-
61
- You can see a working example here [JSFiddle](https://jsfiddle.net/mrklein/s97Ld0gn).
62
-
63
- ## Storybook
64
-
65
- Explore the complete description of supported QTI tags, examples, and the ability to interactively play with changing attributes of the QTI items in our [Storybook](https://qti-components.citolab.nl/).
66
-
67
- ## Contributing
68
-
69
- Contributions are welcome! Please follow these guidelines when contributing:
70
-
71
- - Fork the repository and clone it to your local machine
72
- - Create a new branch for your feature or bug fix
73
- - Commit your changes with clear and concise messages
74
- - Push your changes to your forked repository
75
- - Open a pull request to the original repository
76
-
77
- ## License
78
-
79
- This project is licensed under the [GPLv3 License](LICENSE).
80
-
81
- Please note that the licensing is GPLv3 if you want to use it in another way, feel free to ask!
82
-
83
- ```
84
-
85
- ```