@citolab/qti-components 6.0.3-9 → 6.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/LICENSE +674 -21
- package/dist/ExpressionResult-b1ac7b27.d.ts +23 -0
- package/dist/chunk-7KH3TY23.js +18 -0
- package/dist/chunk-7LF4QM4D.js +17 -0
- package/dist/chunk-M3YT56HW.js +1437 -0
- package/dist/{chunk-XN7FAHIO.js → chunk-MYPYIYN5.js} +28 -344
- package/dist/custom-elements.json +2083 -1292
- package/dist/index.css +1 -0
- package/dist/index.js +191 -2360
- package/dist/{qti-assessment-item-a65f152b.d.ts → qti-assessment-item-219cef9e.d.ts} +2 -19
- package/dist/qti-components/index.d.ts +156 -72
- package/dist/qti-components/index.js +77 -142
- package/dist/qti-components.js +13502 -0
- package/dist/qti-item/index.css +1 -0
- package/dist/qti-item/index.d.ts +9 -10
- package/dist/qti-item/index.js +1 -1
- package/dist/qti-item-react/index.css +1 -0
- package/dist/qti-item-react/index.d.ts +4 -6
- package/dist/qti-item-react/index.js +1 -1
- package/dist/{qti-simple-choice-4df32b16.d.ts → qti-rule-5fe4f91e.d.ts} +25 -74
- package/dist/{qti-simple-choice-24c4c8e9.d.ts → qti-rule-e2aee685.d.ts} +31 -31
- package/dist/qti-transform/index.d.ts +2 -1
- package/dist/qti-transform/index.js +87 -2
- package/dist/themes/qti.css +261 -737
- package/dist/vite.svg +1 -0
- package/package.json +10 -4
- package/readme.md +88 -66
- package/dist/chunk-CTF6QUBO.js +0 -2211
- package/dist/chunk-N4ENDK7Q.js +0 -2211
- package/dist/chunk-NG425SE2.js +0 -2178
- package/dist/qti-assessment-item-f1fcf393.d.ts +0 -120
- package/dist/qti-simple-choice-988808a2.d.ts +0 -352
- package/dist/vscode.html-custom-data.json +0 -775
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/package.json
CHANGED
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
"Sander Looise",
|
|
8
8
|
"Marcel Hoekstra"
|
|
9
9
|
],
|
|
10
|
-
"license": "
|
|
10
|
+
"license": "GPLv3",
|
|
11
11
|
"private": false,
|
|
12
|
-
"
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=16.0.0"
|
|
14
|
+
},
|
|
15
|
+
"version": "6.0.3",
|
|
13
16
|
"type": "module",
|
|
14
17
|
"main": "dist/qti-components/index.js",
|
|
15
18
|
"exports": {
|
|
@@ -29,8 +32,9 @@
|
|
|
29
32
|
"./qti-transform": {
|
|
30
33
|
"import": "./dist/qti-transform/index.js"
|
|
31
34
|
},
|
|
32
|
-
"./index.css":
|
|
33
|
-
|
|
35
|
+
"./index.css": {
|
|
36
|
+
"import": "./dist/index.css"
|
|
37
|
+
}
|
|
34
38
|
},
|
|
35
39
|
"types": "./dist/qti-components/index.d.ts",
|
|
36
40
|
"typesVersions": {
|
|
@@ -63,7 +67,9 @@
|
|
|
63
67
|
"build": "tsc && vite build",
|
|
64
68
|
"build-lib": "ts-node --esm --project tsconfig.node.json scripts/build.ts",
|
|
65
69
|
"storybook": "storybook dev -p 6006",
|
|
70
|
+
"deploy": "firebase deploy --only hosting:qti-components",
|
|
66
71
|
"build-storybook": "storybook build",
|
|
72
|
+
"publish:latest": "npx np",
|
|
67
73
|
"publish:next": "npx np --tag next",
|
|
68
74
|
"test-storybook": "test-storybook",
|
|
69
75
|
"cem": "cem analyze --watch",
|
package/readme.md
CHANGED
|
@@ -1,79 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
npm
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-- build scripts
|
|
16
|
-
npm i -D ts-node
|
|
17
|
-
npm i -D @custom-elements-manifest/analyzer
|
|
18
|
-
npm i -D tsup
|
|
19
|
-
|
|
20
|
-
`tsconfig.json`
|
|
21
|
-
|
|
22
|
-
```json
|
|
23
|
-
-- "module": "ESNext",
|
|
24
|
-
++ "target": "es2017",
|
|
25
|
-
|
|
26
|
-
-- strict: "true"
|
|
27
|
-
++ strict: "false"
|
|
28
|
-
|
|
29
|
-
-- "noUnusedLocals": true,
|
|
30
|
-
++ "noUnusedLocals": false,
|
|
31
|
-
-- "noUnusedParameters": true,
|
|
32
|
-
++ "noUnusedParameters": false,
|
|
33
|
-
|
|
34
|
-
++ "esModuleInterop": true,
|
|
35
|
-
++ "resolveJsonModule": true
|
|
1
|
+
# @citolab/qti-components
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/%40citolab%2Fqti-components)
|
|
4
|
+
[](https://opensource.org/license/gpl-2-0/)
|
|
5
|
+
|
|
6
|
+
@citolab/qti-components is a web component library that can be used to render 1EdTech QTI items.
|
|
7
|
+
It's highly customizable and can be integrated in almost every web application.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Use npm to install the package:
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
npm install @citolab/qti-components
|
|
36
15
|
```
|
|
37
16
|
|
|
38
|
-
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
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.
|
|
39
20
|
|
|
40
|
-
|
|
41
|
-
|
|
21
|
+
Here's a basic example:
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
import * as QTI from 'https://unpkg.com/@citolab/qti-components@next/dist/index.js';
|
|
25
|
+
```
|
|
42
26
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"@storybook/addon-essentials",
|
|
46
|
-
++ "@storybook/addon-jest",
|
|
47
|
-
++ "@storybook/addon-interactions",
|
|
48
|
-
],
|
|
27
|
+
```css
|
|
28
|
+
@import 'https://unpkg.com/@citolab/qti-components@next/dist/index.css';'
|
|
49
29
|
```
|
|
50
30
|
|
|
51
|
-
|
|
31
|
+
```html
|
|
32
|
+
<qti-assessment-item identifier="choice" title="Unattended Luggage" adaptive="false" time-dependent="false">
|
|
33
|
+
<qti-response-declaration identifier="RESPONSE" cardinality="single" base-type="identifier">
|
|
34
|
+
<qti-correct-response>
|
|
35
|
+
<qti-value>ChoiceA</qti-value>
|
|
36
|
+
</qti-correct-response>
|
|
37
|
+
</qti-response-declaration>
|
|
38
|
+
<qti-outcome-declaration identifier="SCORE" cardinality="single" base-type="float">
|
|
39
|
+
<qti-default-value>
|
|
40
|
+
<qti-value>0</qti-value>
|
|
41
|
+
</qti-default-value>
|
|
42
|
+
</qti-outcome-declaration>
|
|
43
|
+
<qti-item-body>
|
|
44
|
+
<p>Look at the text in the picture.</p>
|
|
45
|
+
<p>
|
|
46
|
+
<img src="images/sign.png" alt="NEVER LEAVE LUGGAGE UNATTENDED"/>
|
|
47
|
+
</p>
|
|
48
|
+
<qti-choice-interaction response-identifier="RESPONSE" shuffle="false" max-choices="1">
|
|
49
|
+
<qti-prompt>What does it say?</qti-prompt>
|
|
50
|
+
<qti-simple-choice identifier="ChoiceA">You must stay with your luggage at all times.</qti-simple-choice>
|
|
51
|
+
<qti-simple-choice identifier="ChoiceB">Do not let someone else look after your luggage.</qti-simple-choice>
|
|
52
|
+
<qti-simple-choice identifier="ChoiceC">Remember your luggage when you leave.</qti-simple-choice>
|
|
53
|
+
</qti-choice-interaction>
|
|
54
|
+
</qti-item-body>
|
|
55
|
+
<qti-response-processing template="https://purl.imsglobal.org/spec/qti/v3p0/rptemplates/match_correct.xml"/>
|
|
56
|
+
</qti-assessment-item>
|
|
52
57
|
|
|
53
|
-
```ts
|
|
54
|
-
++ import '../src/styles.css';
|
|
55
58
|
```
|
|
56
59
|
|
|
57
|
-
|
|
60
|
+
You can see a working example here [JSFiddle](https://jsfiddle.net/mrklein/s97Ld0gn).
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
For a bit more advanced example using React and the QTIItem React wrapper from the package, you can check out this [StackBlitz](https://stackblitz.com/edit/qti-player). The item is integrated into a React component like this:
|
|
63
|
+
|
|
64
|
+
```jsx
|
|
65
|
+
<QtiItem
|
|
66
|
+
className="w-full h-[480px] bg-white shadow p-4"
|
|
67
|
+
responses={itemResponses.current.get(itemId!)}
|
|
68
|
+
qtiinteractionchanged={({ detail }: { detail: any }) => {
|
|
69
|
+
storeResponse(detail.item, detail.response, detail.responseIdentifier);
|
|
70
|
+
}}
|
|
71
|
+
qtioutcomechanged={(e: any) => {
|
|
72
|
+
itemOutcomes.current.set(items[itemIndex].identifier, e.detail.value);
|
|
73
|
+
}}
|
|
74
|
+
qtiitemconnected={(e: any) => {
|
|
75
|
+
qtiItem.current = e.target;
|
|
76
|
+
setItemId(e.detail.identifier);
|
|
77
|
+
}}
|
|
78
|
+
xml={itemXML}
|
|
79
|
+
></QtiItem>
|
|
63
80
|
```
|
|
64
81
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
## Storybook
|
|
83
|
+
|
|
84
|
+
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/).
|
|
85
|
+
|
|
86
|
+
## Contributing
|
|
87
|
+
|
|
88
|
+
Contributions are welcome! Please follow these guidelines when contributing:
|
|
89
|
+
|
|
90
|
+
- Fork the repository and clone it to your local machine
|
|
91
|
+
- Create a new branch for your feature or bug fix
|
|
92
|
+
- Commit your changes with clear and concise messages
|
|
93
|
+
- Push your changes to your forked repository
|
|
94
|
+
- Open a pull request to the original repository
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
This project is licensed under the [GPLv3 License](LICENSE).
|
|
99
|
+
|
|
100
|
+
Please note that the licensing is GPLv3 if you want to use it in another way, feel free to ask!
|
|
79
101
|
```
|