@webwriter/quiz 1.1.5 → 2.0.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.
- package/LICENSE +1 -1
- package/README.md +778 -0
- package/assets/icons/grip-horizontal.svg +8 -0
- package/assets/icons/grip-vertical.svg +8 -0
- package/assets/icons/truefalse.svg +6 -0
- package/custom-elements.json +2779 -0
- package/custom.d.ts +5 -1
- package/dist/api/index.d.ts +27 -0
- package/dist/api/index.js +40 -0
- package/dist/migrate.js +1434 -0
- package/dist/widgets/webwriter-choice-item.js +4095 -3818
- package/dist/widgets/webwriter-choice.js +2179 -5598
- package/dist/widgets/webwriter-gap-item.js +3987 -0
- package/dist/widgets/webwriter-gap.js +2908 -0
- package/dist/widgets/webwriter-mark.js +4347 -3368
- package/dist/widgets/webwriter-order-item.js +4038 -3197
- package/dist/widgets/webwriter-order.js +2885 -4200
- package/dist/widgets/webwriter-pairing-item.js +1070 -2330
- package/dist/widgets/webwriter-pairing.js +2968 -4231
- package/dist/widgets/webwriter-quiz-hint.js +2469 -0
- package/dist/widgets/webwriter-quiz.js +3337 -4364
- package/dist/widgets/webwriter-speech.js +6100 -5120
- package/dist/widgets/webwriter-task-prompt.js +4787 -2068
- package/dist/widgets/webwriter-task.js +2264 -8157
- package/dist/widgets/webwriter-text.js +4075 -4132
- package/dist/widgets/webwriter-true-false.js +4674 -0
- package/editing-config.json +106 -0
- package/lit-localize.json +20 -14
- package/localization/de.xlf +395 -65
- package/localization/es.xlf +396 -61
- package/localization/fr.xlf +396 -61
- package/localization/generated/de.ts +97 -15
- package/localization/generated/es.ts +97 -15
- package/localization/generated/fr.ts +98 -16
- package/localization/generated/index.d.ts +5 -0
- package/localization/generated/it.ts +96 -14
- package/localization/generated/locale-codes.js +0 -48
- package/localization/generated/nl.ts +99 -17
- package/localization/it.xlf +396 -61
- package/localization/nl.xlf +396 -61
- package/package.json +120 -254
- package/scripts/apply-translations.mjs +97 -0
- package/src/api/index.ts +72 -0
- package/src/lib/artboard.ts +686 -0
- package/src/lib/draggable-grid.ts +432 -0
- package/src/lib/encrypted-property.ts +202 -0
- package/src/lib/hint-popup.ts +152 -0
- package/src/lib/utils.ts +97 -0
- package/src/lib/webwriter-quirks.ts +121 -0
- package/src/migrate/index.ts +622 -0
- package/src/migrate/legacy-solution.ts +362 -0
- package/src/snippets/order.html +8 -7
- package/src/widgets/choice/webwriter-choice-item.ts +316 -0
- package/src/widgets/choice/webwriter-choice.ts +328 -0
- package/src/widgets/choice/webwriter-true-false.ts +113 -0
- package/src/widgets/dnd/webwriter-dnd-draggable.ts +28 -0
- package/src/widgets/dnd/webwriter-dnd-dropzone.ts +9 -0
- package/src/widgets/dnd/webwriter-dnd.ts +36 -0
- package/src/widgets/gap/webwriter-gap-item.ts +250 -0
- package/src/widgets/gap/webwriter-gap.ts +447 -0
- package/src/widgets/order/webwriter-order-item.ts +243 -0
- package/src/widgets/order/webwriter-order.ts +282 -0
- package/src/widgets/pairing/webwriter-pairing-item.ts +46 -0
- package/src/widgets/pairing/webwriter-pairing.ts +934 -0
- package/src/widgets/speech/audio-player.ts +325 -0
- package/src/widgets/speech/audio-recorder.ts +285 -0
- package/src/widgets/speech/waveform.ts +113 -0
- package/src/widgets/speech/webwriter-speech.ts +87 -0
- package/src/widgets/webwriter-mark.ts +366 -424
- package/src/widgets/webwriter-quiz-hint.ts +36 -0
- package/src/widgets/webwriter-quiz.ts +318 -280
- package/src/widgets/webwriter-task-prompt.ts +43 -18
- package/src/widgets/webwriter-task.ts +212 -551
- package/src/widgets/webwriter-text.ts +286 -172
- package/tsconfig.api.json +12 -0
- package/tsconfig.json +7 -6
- package/dist/widgets/webwriter-choice.css +0 -444
- package/dist/widgets/webwriter-cloze-gap.css +0 -444
- package/dist/widgets/webwriter-cloze-gap.js +0 -5727
- package/dist/widgets/webwriter-cloze.css +0 -444
- package/dist/widgets/webwriter-cloze.js +0 -3653
- package/dist/widgets/webwriter-mark.css +0 -444
- package/dist/widgets/webwriter-order.css +0 -444
- package/dist/widgets/webwriter-pairing-item.css +0 -444
- package/dist/widgets/webwriter-pairing.css +0 -444
- package/dist/widgets/webwriter-quiz.css +0 -444
- package/dist/widgets/webwriter-task-explainer.css +0 -444
- package/dist/widgets/webwriter-task-explainer.js +0 -2769
- package/dist/widgets/webwriter-task-hint.css +0 -444
- package/dist/widgets/webwriter-task-hint.js +0 -2708
- package/dist/widgets/webwriter-task.css +0 -444
- package/dist/widgets/webwriter-text.css +0 -444
- package/localization/bg.xlf +0 -72
- package/localization/cs.xlf +0 -72
- package/localization/da.xlf +0 -72
- package/localization/el.xlf +0 -72
- package/localization/et.xlf +0 -72
- package/localization/fi.xlf +0 -72
- package/localization/generated/bg.ts +0 -31
- package/localization/generated/cs.ts +0 -31
- package/localization/generated/da.ts +0 -31
- package/localization/generated/el.ts +0 -31
- package/localization/generated/et.ts +0 -31
- package/localization/generated/fi.ts +0 -31
- package/localization/generated/hu.ts +0 -31
- package/localization/generated/id.ts +0 -31
- package/localization/generated/ja.ts +0 -31
- package/localization/generated/ko.ts +0 -31
- package/localization/generated/lt.ts +0 -31
- package/localization/generated/lv.ts +0 -31
- package/localization/generated/nb.ts +0 -31
- package/localization/generated/pl.ts +0 -31
- package/localization/generated/pt-BR.ts +0 -31
- package/localization/generated/pt-PT.ts +0 -31
- package/localization/generated/ro.ts +0 -31
- package/localization/generated/ru.ts +0 -31
- package/localization/generated/sk.ts +0 -31
- package/localization/generated/sl.ts +0 -31
- package/localization/generated/sv.ts +0 -31
- package/localization/generated/tr.ts +0 -31
- package/localization/generated/uk.ts +0 -31
- package/localization/generated/zh-hans.ts +0 -31
- package/localization/hu.xlf +0 -72
- package/localization/id.xlf +0 -72
- package/localization/ja.xlf +0 -72
- package/localization/ko.xlf +0 -72
- package/localization/lt.xlf +0 -72
- package/localization/lv.xlf +0 -72
- package/localization/nb.xlf +0 -72
- package/localization/pl.xlf +0 -72
- package/localization/pt-BR.xlf +0 -72
- package/localization/pt-PT.xlf +0 -72
- package/localization/ro.xlf +0 -72
- package/localization/ru.xlf +0 -72
- package/localization/sk.xlf +0 -72
- package/localization/sl.xlf +0 -72
- package/localization/sv.xlf +0 -72
- package/localization/tr.xlf +0 -72
- package/localization/uk.xlf +0 -72
- package/localization/zh-hans.xlf +0 -72
- package/src/lib/combobox.ts +0 -456
- package/src/lib/highlighter-fill.svg +0 -6
- package/src/snippets/Beispiel-Choice.html +0 -57
- package/src/snippets/Beispiel-Mark.html +0 -14
- package/src/snippets/Beispiel-Order.html +0 -52
- package/src/snippets/Beispiel-Text.html +0 -20
- package/src/snippets/blank.html +0 -1
- package/src/snippets/choice.html +0 -8
- package/src/snippets/cloze.html +0 -4
- package/src/snippets/mark.html +0 -4
- package/src/snippets/pairing.html +0 -10
- package/src/snippets/speech.html +0 -4
- package/src/snippets/text.html +0 -4
- package/src/snippets/wordsearch.html +0 -4
- package/src/widgets/webwriter-choice-item.ts +0 -257
- package/src/widgets/webwriter-choice.ts +0 -353
- package/src/widgets/webwriter-cloze-gap.ts +0 -216
- package/src/widgets/webwriter-cloze.ts +0 -136
- package/src/widgets/webwriter-order-item.ts +0 -441
- package/src/widgets/webwriter-order.ts +0 -327
- package/src/widgets/webwriter-pairing-item.ts +0 -161
- package/src/widgets/webwriter-pairing.ts +0 -193
- package/src/widgets/webwriter-speech.ts +0 -273
- package/src/widgets/webwriter-task-explainer.ts +0 -43
- package/src/widgets/webwriter-task-hint.ts +0 -23
package/README.md
ADDED
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
# Quiz (`@webwriter/quiz@2.0.0`)
|
|
2
|
+
[License: MIT](LICENSE) | Version: 2.0.0
|
|
3
|
+
|
|
4
|
+
Add interactive tasks (multiple choice, order, free text, highlighting, or speech input). Make a quiz out of multiple tasks.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## `WebwriterQuiz` (`<webwriter-quiz>`)
|
|
11
|
+
A quiz groups multiple `<webwriter-task>` elements into one exercise that is
|
|
12
|
+
submitted, graded and reset as a whole.
|
|
13
|
+
|
|
14
|
+
The tasks must be assigned to the default slot.
|
|
15
|
+
|
|
16
|
+
### Usage
|
|
17
|
+
|
|
18
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
19
|
+
```html
|
|
20
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-quiz.css" rel="stylesheet">
|
|
21
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-quiz.js"></script>
|
|
22
|
+
<webwriter-quiz></webwriter-quiz>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
npm install @webwriter/quiz
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<link href="@webwriter/quiz/widgets/webwriter-quiz.css" rel="stylesheet">
|
|
33
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-quiz.js"></script>
|
|
34
|
+
<webwriter-quiz></webwriter-quiz>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Fields
|
|
38
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
39
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
40
|
+
| `detailedFeedback` (`detailed-feedback`) | `boolean` | Whether learners see per-answer feedback and the solution after submitting. | `false` | ✓ |
|
|
41
|
+
| `confirmSubmit` (`confirm-submit`) | `boolean` | Whether learners have to confirm a dialog before submitting. | `false` | ✓ |
|
|
42
|
+
| `confirmReset` (`confirm-reset`) | `boolean` | Whether learners have to confirm a dialog before resetting. | `false` | ✓ |
|
|
43
|
+
| `hidePoints` (`hide-points`) | `boolean` | Whether the points of each task and the total score are hidden. | `false` | ✓ |
|
|
44
|
+
|
|
45
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
46
|
+
|
|
47
|
+
## Editing config
|
|
48
|
+
| Name | Value |
|
|
49
|
+
| :--: | :---------: |
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
53
|
+
|
|
54
|
+
*No public methods, slots, events, custom CSS properties, or CSS parts.*
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## `WebwriterTask` (`<webwriter-task>`)
|
|
58
|
+
A task describes a single quiz question, which consists of a
|
|
59
|
+
`<webwriter-task-prompt>`, an optional `<webwriter-quiz-hint>` and an answer
|
|
60
|
+
of a certain type, such as `<webwriter-choice>`.
|
|
61
|
+
|
|
62
|
+
The `<webwriter-task-prompt>` must be assigned to the `prompt` slot, the
|
|
63
|
+
`<webwriter-quiz-hint>` must be assigned to the `hint` slot and the answer
|
|
64
|
+
must be assigned to the default slot.
|
|
65
|
+
|
|
66
|
+
### Usage
|
|
67
|
+
|
|
68
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
69
|
+
```html
|
|
70
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-task.css" rel="stylesheet">
|
|
71
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-task.js"></script>
|
|
72
|
+
<webwriter-task></webwriter-task>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
npm install @webwriter/quiz
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<link href="@webwriter/quiz/widgets/webwriter-task.css" rel="stylesheet">
|
|
83
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-task.js"></script>
|
|
84
|
+
<webwriter-task></webwriter-task>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Editing config
|
|
88
|
+
| Name | Value |
|
|
89
|
+
| :--: | :---------: |
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
93
|
+
|
|
94
|
+
*No public fields, methods, slots, events, custom CSS properties, or CSS parts.*
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
## `WebwriterTaskPrompt` (`<webwriter-task-prompt>`)
|
|
98
|
+
The question text of a `<webwriter-task>`.
|
|
99
|
+
|
|
100
|
+
It must be assigned to the `prompt` slot of its parent element. An optional
|
|
101
|
+
`<webwriter-quiz-hint>` may be assigned to its `hint` slot.
|
|
102
|
+
|
|
103
|
+
### Usage
|
|
104
|
+
|
|
105
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
106
|
+
```html
|
|
107
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-task-prompt.css" rel="stylesheet">
|
|
108
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-task-prompt.js"></script>
|
|
109
|
+
<webwriter-task-prompt></webwriter-task-prompt>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
npm install @webwriter/quiz
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```html
|
|
119
|
+
<link href="@webwriter/quiz/widgets/webwriter-task-prompt.css" rel="stylesheet">
|
|
120
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-task-prompt.js"></script>
|
|
121
|
+
<webwriter-task-prompt></webwriter-task-prompt>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Editing config
|
|
125
|
+
| Name | Value |
|
|
126
|
+
| :--: | :---------: |
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
130
|
+
|
|
131
|
+
*No public fields, methods, slots, events, custom CSS properties, or CSS parts.*
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## `WebwriterQuizHint` (`<webwriter-quiz-hint>`)
|
|
135
|
+
A generic hint element that can be used inside a variety of elements that
|
|
136
|
+
explicitly mention it in their documentation, such as `<webwriter-task>`.
|
|
137
|
+
|
|
138
|
+
Unless otherwise specified, it should be assigned to the `hint` slot of its
|
|
139
|
+
parent element.
|
|
140
|
+
|
|
141
|
+
### Usage
|
|
142
|
+
|
|
143
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
144
|
+
```html
|
|
145
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-quiz-hint.css" rel="stylesheet">
|
|
146
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-quiz-hint.js"></script>
|
|
147
|
+
<webwriter-quiz-hint></webwriter-quiz-hint>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
npm install @webwriter/quiz
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```html
|
|
157
|
+
<link href="@webwriter/quiz/widgets/webwriter-quiz-hint.css" rel="stylesheet">
|
|
158
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-quiz-hint.js"></script>
|
|
159
|
+
<webwriter-quiz-hint></webwriter-quiz-hint>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Editing config
|
|
163
|
+
| Name | Value |
|
|
164
|
+
| :--: | :---------: |
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
168
|
+
|
|
169
|
+
*No public fields, methods, slots, events, custom CSS properties, or CSS parts.*
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
## `WebwriterTrueFalse` (`<webwriter-true-false>`)
|
|
173
|
+
An answer where learners decide whether a statement is true or false.
|
|
174
|
+
|
|
175
|
+
It must be assigned to the default slot of a `<webwriter-task>`.
|
|
176
|
+
|
|
177
|
+
### Usage
|
|
178
|
+
|
|
179
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
180
|
+
```html
|
|
181
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-true-false.css" rel="stylesheet">
|
|
182
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-true-false.js"></script>
|
|
183
|
+
<webwriter-true-false></webwriter-true-false>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
npm install @webwriter/quiz
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
```html
|
|
193
|
+
<link href="@webwriter/quiz/widgets/webwriter-true-false.css" rel="stylesheet">
|
|
194
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-true-false.js"></script>
|
|
195
|
+
<webwriter-true-false></webwriter-true-false>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Fields
|
|
199
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
200
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
201
|
+
| `solution` (`solution`) | `TrueFalse` | The value counting as correct.<br><br>- `true`: The statement is true.<br>- `false`: The statement is false. | `"true"` | ✓ |
|
|
202
|
+
|
|
203
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
204
|
+
|
|
205
|
+
## Methods
|
|
206
|
+
| Name | Description | Parameters |
|
|
207
|
+
| :--: | :---------: | :-------: |
|
|
208
|
+
| `checkValidity` | - | -
|
|
209
|
+
| `reset` | - | -
|
|
210
|
+
| `checkAnswer` | - | `detailedFeedback: boolean`
|
|
211
|
+
|
|
212
|
+
*[Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions) allow programmatic access to the widget.*
|
|
213
|
+
|
|
214
|
+
## Editing config
|
|
215
|
+
| Name | Value |
|
|
216
|
+
| :--: | :---------: |
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
220
|
+
|
|
221
|
+
*No public slots, events, custom CSS properties, or CSS parts.*
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
## `WebwriterChoice` (`<webwriter-choice>`)
|
|
225
|
+
An answer where learners pick one or more options.
|
|
226
|
+
|
|
227
|
+
The options must be `<webwriter-choice-item>` elements assigned to the
|
|
228
|
+
default slot.
|
|
229
|
+
|
|
230
|
+
### Usage
|
|
231
|
+
|
|
232
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
233
|
+
```html
|
|
234
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-choice.css" rel="stylesheet">
|
|
235
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-choice.js"></script>
|
|
236
|
+
<webwriter-choice></webwriter-choice>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
npm install @webwriter/quiz
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
```html
|
|
246
|
+
<link href="@webwriter/quiz/widgets/webwriter-choice.css" rel="stylesheet">
|
|
247
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-choice.js"></script>
|
|
248
|
+
<webwriter-choice></webwriter-choice>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Fields
|
|
252
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
253
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
254
|
+
| `mode` (`mode`) | `ChoiceMode` | How many options learners may select.<br><br>- `single`: Exactly one option can be selected.<br>- `multiple`: Any number of options can be selected. | `"single"` | ✓ |
|
|
255
|
+
| `layout` (`layout`) | `ChoiceLayout` | How the options are arranged.<br><br>- `list`: One option per row.<br>- `tiles`: A responsive grid of equally sized tiles. | `"list"` | ✓ |
|
|
256
|
+
| `gradingMethod` (`grading-method`) | `ChoiceGradingMethod` | How the score of this answer is calculated.<br><br>- `pass-fail`: Full score only if exactly the correct options are selected.<br>- `partial`: Correct selections earn credit, wrong ones subtract from it. | `"pass-fail"` | ✓ |
|
|
257
|
+
| `solution` (`solution`) | `ChoiceSolution` | The options counting as correct, as a map from option ID to whether it has to be selected.<br>It is obfuscated in the markup so that learners cannot read it directly. | `{}` | ✓ |
|
|
258
|
+
|
|
259
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
260
|
+
|
|
261
|
+
## Methods
|
|
262
|
+
| Name | Description | Parameters |
|
|
263
|
+
| :--: | :---------: | :-------: |
|
|
264
|
+
| `checkValidity` | - | -
|
|
265
|
+
| `checkAnswer` | - | `detailedFeedback: boolean`
|
|
266
|
+
| `reset` | - | -
|
|
267
|
+
|
|
268
|
+
*[Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions) allow programmatic access to the widget.*
|
|
269
|
+
|
|
270
|
+
## Editing config
|
|
271
|
+
| Name | Value |
|
|
272
|
+
| :--: | :---------: |
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
276
|
+
|
|
277
|
+
*No public slots, events, custom CSS properties, or CSS parts.*
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
## `WebwriterChoiceItem` (`<webwriter-choice-item>`)
|
|
281
|
+
A single option of a `<webwriter-choice>`.
|
|
282
|
+
|
|
283
|
+
It must be assigned to the default slot of its parent element. An optional
|
|
284
|
+
`<webwriter-quiz-hint>` may be assigned to its `hint` slot.
|
|
285
|
+
|
|
286
|
+
### Usage
|
|
287
|
+
|
|
288
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
289
|
+
```html
|
|
290
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-choice-item.css" rel="stylesheet">
|
|
291
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-choice-item.js"></script>
|
|
292
|
+
<webwriter-choice-item></webwriter-choice-item>
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
296
|
+
|
|
297
|
+
```
|
|
298
|
+
npm install @webwriter/quiz
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
```html
|
|
302
|
+
<link href="@webwriter/quiz/widgets/webwriter-choice-item.css" rel="stylesheet">
|
|
303
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-choice-item.js"></script>
|
|
304
|
+
<webwriter-choice-item></webwriter-choice-item>
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## Fields
|
|
308
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
309
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
310
|
+
| `feedbackSelected` (`feedback-selected`) | `string` | The feedback shown after submitting if learners selected this option. | `""` | ✓ |
|
|
311
|
+
| `feedbackNotSelected` (`feedback-not-selected`) | `string` | The feedback shown after submitting if learners did not select this option. | `""` | ✓ |
|
|
312
|
+
|
|
313
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
314
|
+
|
|
315
|
+
## Editing config
|
|
316
|
+
| Name | Value |
|
|
317
|
+
| :--: | :---------: |
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
321
|
+
|
|
322
|
+
*No public methods, slots, events, custom CSS properties, or CSS parts.*
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
## `WebwriterOrder` (`<webwriter-order>`)
|
|
326
|
+
An answer where learners drag items into the correct order.
|
|
327
|
+
|
|
328
|
+
The items must be `<webwriter-order-item>` elements assigned to the default
|
|
329
|
+
slot.
|
|
330
|
+
|
|
331
|
+
### Usage
|
|
332
|
+
|
|
333
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
334
|
+
```html
|
|
335
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-order.css" rel="stylesheet">
|
|
336
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-order.js"></script>
|
|
337
|
+
<webwriter-order></webwriter-order>
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
npm install @webwriter/quiz
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
```html
|
|
347
|
+
<link href="@webwriter/quiz/widgets/webwriter-order.css" rel="stylesheet">
|
|
348
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-order.js"></script>
|
|
349
|
+
<webwriter-order></webwriter-order>
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## Fields
|
|
353
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
354
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
355
|
+
| `layout` (`layout`) | `OrderLayout` | How the items are arranged.<br><br>- `list`: One item per row.<br>- `tiles`: A responsive grid of equally sized tiles. | `"list"` | ✓ |
|
|
356
|
+
| `direction` (`direction`) | `OrderDirection` | The direction in which the items are numbered.<br><br>- `ascending`: The first item carries the lowest position.<br>- `descending`: The first item carries the highest position. | `"ascending"` | ✓ |
|
|
357
|
+
| `numberingStyle` (`numbering-style`) | `OrderNumberingStyle` | How the position of each item is labelled.<br><br>- `none`: No position is shown.<br>- `numeric`: Arabic numerals (1., 2., 3., ...).<br>- `alphabetic`: Latin letters (A., B., C., ...).<br>- `roman`: Roman numerals (I., II., III., ...). | `"numeric"` | ✓ |
|
|
358
|
+
| `gradingMethod` (`grading-method`) | `OrderGradingMethod` | How the score of this answer is calculated.<br><br>- `pass-fail`: Full score only if every item is in its correct position.<br>- `partial-position`: Credit for each item in its correct position.<br>- `partial-sequence`: Credit for each pair of adjacent items in the correct order. | `"pass-fail"` | ✓ |
|
|
359
|
+
| `solution` (`solution`) | `OrderSolution` | The IDs of the items in their correct order. It is obfuscated in the markup so that learners cannot read it directly. | `[]` | ✓ |
|
|
360
|
+
|
|
361
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
362
|
+
|
|
363
|
+
## Methods
|
|
364
|
+
| Name | Description | Parameters |
|
|
365
|
+
| :--: | :---------: | :-------: |
|
|
366
|
+
| `checkValidity` | - | -
|
|
367
|
+
| `reset` | - | -
|
|
368
|
+
| `checkAnswer` | - | `detailedFeedback: boolean`
|
|
369
|
+
|
|
370
|
+
*[Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions) allow programmatic access to the widget.*
|
|
371
|
+
|
|
372
|
+
## Editing config
|
|
373
|
+
| Name | Value |
|
|
374
|
+
| :--: | :---------: |
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
378
|
+
|
|
379
|
+
*No public slots, events, custom CSS properties, or CSS parts.*
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
## `WebwriterOrderItem` (`<webwriter-order-item>`)
|
|
383
|
+
A single item of a `<webwriter-order>`.
|
|
384
|
+
|
|
385
|
+
It must be assigned to the default slot of its parent element. An optional
|
|
386
|
+
`<webwriter-quiz-hint>` may be assigned to its `hint` slot.
|
|
387
|
+
|
|
388
|
+
### Usage
|
|
389
|
+
|
|
390
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
391
|
+
```html
|
|
392
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-order-item.css" rel="stylesheet">
|
|
393
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-order-item.js"></script>
|
|
394
|
+
<webwriter-order-item></webwriter-order-item>
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
398
|
+
|
|
399
|
+
```
|
|
400
|
+
npm install @webwriter/quiz
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
```html
|
|
404
|
+
<link href="@webwriter/quiz/widgets/webwriter-order-item.css" rel="stylesheet">
|
|
405
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-order-item.js"></script>
|
|
406
|
+
<webwriter-order-item></webwriter-order-item>
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
## Editing config
|
|
410
|
+
| Name | Value |
|
|
411
|
+
| :--: | :---------: |
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
415
|
+
|
|
416
|
+
*No public fields, methods, slots, events, custom CSS properties, or CSS parts.*
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
## `WebwriterSpeech` (`<webwriter-speech>`)
|
|
420
|
+
An answer where learners record a spoken response.
|
|
421
|
+
|
|
422
|
+
It must be assigned to the default slot of a `<webwriter-task>`.
|
|
423
|
+
|
|
424
|
+
### Usage
|
|
425
|
+
|
|
426
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
427
|
+
```html
|
|
428
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-speech.css" rel="stylesheet">
|
|
429
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-speech.js"></script>
|
|
430
|
+
<webwriter-speech></webwriter-speech>
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
434
|
+
|
|
435
|
+
```
|
|
436
|
+
npm install @webwriter/quiz
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
```html
|
|
440
|
+
<link href="@webwriter/quiz/widgets/webwriter-speech.css" rel="stylesheet">
|
|
441
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-speech.js"></script>
|
|
442
|
+
<webwriter-speech></webwriter-speech>
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
## Fields
|
|
446
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
447
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
448
|
+
| `src` (`src`) | `string \| null` | The recording of the learner as a data URL, or `null` if nothing was recorded yet. | `null` | ✓ |
|
|
449
|
+
|
|
450
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
451
|
+
|
|
452
|
+
## Methods
|
|
453
|
+
| Name | Description | Parameters |
|
|
454
|
+
| :--: | :---------: | :-------: |
|
|
455
|
+
| `reset` | - | -
|
|
456
|
+
| `checkValidity` | - | -
|
|
457
|
+
|
|
458
|
+
*[Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions) allow programmatic access to the widget.*
|
|
459
|
+
|
|
460
|
+
## Editing config
|
|
461
|
+
| Name | Value |
|
|
462
|
+
| :--: | :---------: |
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
466
|
+
|
|
467
|
+
*No public slots, events, custom CSS properties, or CSS parts.*
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
## `WebwriterText` (`<webwriter-text>`)
|
|
471
|
+
An answer where learners type a value into an input field.
|
|
472
|
+
|
|
473
|
+
It must be assigned to the default slot of a `<webwriter-task>`.
|
|
474
|
+
|
|
475
|
+
### Usage
|
|
476
|
+
|
|
477
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
478
|
+
```html
|
|
479
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-text.css" rel="stylesheet">
|
|
480
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-text.js"></script>
|
|
481
|
+
<webwriter-text></webwriter-text>
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
485
|
+
|
|
486
|
+
```
|
|
487
|
+
npm install @webwriter/quiz
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
```html
|
|
491
|
+
<link href="@webwriter/quiz/widgets/webwriter-text.css" rel="stylesheet">
|
|
492
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-text.js"></script>
|
|
493
|
+
<webwriter-text></webwriter-text>
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
## Fields
|
|
497
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
498
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
499
|
+
| `type` (`type`) | `TextType` | The kind of input field learners answer in.<br><br>- `long-text`: A multi-line text area.<br>- `text`: A single-line text field.<br>- `number`: A number field.<br>- `date`: A date picker.<br>- `time`: A time picker.<br>- `datetime-local`: A combined date and time picker. | `"long-text"` | ✓ |
|
|
500
|
+
| `placeholder` (`placeholder`) | `string` | The placeholder shown while the field is empty. | `""` | ✓ |
|
|
501
|
+
| `freeText` (`free-text`) | `boolean` | Whether any non-empty answer counts as correct, without comparing it to the solution. | `false` | ✓ |
|
|
502
|
+
| `ignoreCase` (`ignore-case`) | `boolean` | Whether the answer is compared to the solution case-insensitively. | `false` | ✓ |
|
|
503
|
+
| `correctMessage` (`correct-message`) | `string` | The feedback shown after submitting if the answer is correct. | `""` | ✓ |
|
|
504
|
+
| `wrongMessage` (`wrong-message`) | `string` | The feedback shown after submitting if the answer is wrong. | `""` | ✓ |
|
|
505
|
+
| `solution` (`solution`) | `string` | The value counting as correct. It is obfuscated in the markup so that learners cannot read it directly. | `""` | ✓ |
|
|
506
|
+
|
|
507
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
508
|
+
|
|
509
|
+
## Methods
|
|
510
|
+
| Name | Description | Parameters |
|
|
511
|
+
| :--: | :---------: | :-------: |
|
|
512
|
+
| `focus` | - | -
|
|
513
|
+
| `checkValidity` | - | -
|
|
514
|
+
| `reset` | - | -
|
|
515
|
+
| `checkAnswer` | - | `detailedFeedback: boolean`
|
|
516
|
+
|
|
517
|
+
*[Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions) allow programmatic access to the widget.*
|
|
518
|
+
|
|
519
|
+
## Editing config
|
|
520
|
+
| Name | Value |
|
|
521
|
+
| :--: | :---------: |
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
525
|
+
|
|
526
|
+
*No public slots, events, custom CSS properties, or CSS parts.*
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
## `WebWriterMark` (`<webwriter-mark>`)
|
|
530
|
+
An answer where learners mark the words of a text that fit the question.
|
|
531
|
+
|
|
532
|
+
The text must be assigned to the default slot; the element itself must be
|
|
533
|
+
assigned to the default slot of a `<webwriter-task>`.
|
|
534
|
+
|
|
535
|
+
### Usage
|
|
536
|
+
|
|
537
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
538
|
+
```html
|
|
539
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-mark.css" rel="stylesheet">
|
|
540
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-mark.js"></script>
|
|
541
|
+
<webwriter-mark></webwriter-mark>
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
545
|
+
|
|
546
|
+
```
|
|
547
|
+
npm install @webwriter/quiz
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
```html
|
|
551
|
+
<link href="@webwriter/quiz/widgets/webwriter-mark.css" rel="stylesheet">
|
|
552
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-mark.js"></script>
|
|
553
|
+
<webwriter-mark></webwriter-mark>
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
## Fields
|
|
557
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
558
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
559
|
+
| `gradingMethod` (`grading-method`) | `MarkGradingMethod` | How the score of this answer is calculated.<br><br>- `pass-fail`: Full score only if exactly the correct words are marked.<br>- `partial`: Correctly marked words earn credit, wrong ones subtract from it. | `"pass-fail"` | ✓ |
|
|
560
|
+
| `solution` (`solution`) | `number[]` | The indices of the word-like segments counting as correct. It is obfuscated in the markup so that learners cannot read it directly. | `[]` | ✓ |
|
|
561
|
+
|
|
562
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
563
|
+
|
|
564
|
+
## Methods
|
|
565
|
+
| Name | Description | Parameters |
|
|
566
|
+
| :--: | :---------: | :-------: |
|
|
567
|
+
| `checkValidity` | - | -
|
|
568
|
+
| `checkAnswer` | - | `detailedFeedback: boolean`
|
|
569
|
+
| `reset` | - | -
|
|
570
|
+
|
|
571
|
+
*[Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions) allow programmatic access to the widget.*
|
|
572
|
+
|
|
573
|
+
## Editing config
|
|
574
|
+
| Name | Value |
|
|
575
|
+
| :--: | :---------: |
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
579
|
+
|
|
580
|
+
*No public slots, events, custom CSS properties, or CSS parts.*
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
## `WebwriterGap` (`<webwriter-gap>`)
|
|
584
|
+
An answer where learners fill the gaps in a text.
|
|
585
|
+
|
|
586
|
+
The text must be assigned to the default slot, with a `<webwriter-gap-item>`
|
|
587
|
+
in place of each gap.
|
|
588
|
+
|
|
589
|
+
### Usage
|
|
590
|
+
|
|
591
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
592
|
+
```html
|
|
593
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-gap.css" rel="stylesheet">
|
|
594
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-gap.js"></script>
|
|
595
|
+
<webwriter-gap></webwriter-gap>
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
599
|
+
|
|
600
|
+
```
|
|
601
|
+
npm install @webwriter/quiz
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
```html
|
|
605
|
+
<link href="@webwriter/quiz/widgets/webwriter-gap.css" rel="stylesheet">
|
|
606
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-gap.js"></script>
|
|
607
|
+
<webwriter-gap></webwriter-gap>
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
## Fields
|
|
611
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
612
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
613
|
+
| `mode` (`mode`) | `GapMode` | How learners fill the gaps.<br><br>- `input`: Each gap is a text field learners type into.<br>- `drag-and-drop`: The gaps are filled from a shared pool of draggable answers. | `"input"` | ✓ |
|
|
614
|
+
| `ignoreCase` (`ignore-case`) | `boolean` | Whether answers are compared to the solution case-insensitively. Only applies in `input` mode. | `false` | ✓ |
|
|
615
|
+
|
|
616
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
617
|
+
|
|
618
|
+
## Methods
|
|
619
|
+
| Name | Description | Parameters |
|
|
620
|
+
| :--: | :---------: | :-------: |
|
|
621
|
+
| `checkValidity` | - | -
|
|
622
|
+
| `reset` | - | -
|
|
623
|
+
| `checkAnswer` | - | `detailedFeedback: boolean`
|
|
624
|
+
|
|
625
|
+
*[Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions) allow programmatic access to the widget.*
|
|
626
|
+
|
|
627
|
+
## Events
|
|
628
|
+
| Name | Description |
|
|
629
|
+
| :--: | :---------: |
|
|
630
|
+
| change | Dispatched when learners move an answer into or out of a gap. Only in `drag-and-drop` mode. |
|
|
631
|
+
|
|
632
|
+
*[Events](https://developer.mozilla.org/en-US/docs/Web/Events) are dispatched by the widget after certain triggers.*
|
|
633
|
+
|
|
634
|
+
## Editing config
|
|
635
|
+
| Name | Value |
|
|
636
|
+
| :--: | :---------: |
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
640
|
+
|
|
641
|
+
*No public slots, custom CSS properties, or CSS parts.*
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
## `WebwriterGapItem` (`<webwriter-gap-item>`)
|
|
645
|
+
A single gap of a `<webwriter-gap>`, whose content is the correct answer.
|
|
646
|
+
|
|
647
|
+
It must be placed inside the text assigned to the default slot of its parent
|
|
648
|
+
element.
|
|
649
|
+
|
|
650
|
+
### Usage
|
|
651
|
+
|
|
652
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
653
|
+
```html
|
|
654
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-gap-item.css" rel="stylesheet">
|
|
655
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-gap-item.js"></script>
|
|
656
|
+
<webwriter-gap-item></webwriter-gap-item>
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
660
|
+
|
|
661
|
+
```
|
|
662
|
+
npm install @webwriter/quiz
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
```html
|
|
666
|
+
<link href="@webwriter/quiz/widgets/webwriter-gap-item.css" rel="stylesheet">
|
|
667
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-gap-item.js"></script>
|
|
668
|
+
<webwriter-gap-item></webwriter-gap-item>
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
## Fields
|
|
672
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
673
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
674
|
+
| `placeholder` (`placeholder`) | `string` | The placeholder shown while the gap is empty. Only applies in `input` mode. | `""` | ✓ |
|
|
675
|
+
|
|
676
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
677
|
+
|
|
678
|
+
## Editing config
|
|
679
|
+
| Name | Value |
|
|
680
|
+
| :--: | :---------: |
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
684
|
+
|
|
685
|
+
*No public methods, slots, events, custom CSS properties, or CSS parts.*
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
## `WebwriterPairing` (`<webwriter-pairing>`)
|
|
689
|
+
An answer where learners match items into pairs.
|
|
690
|
+
|
|
691
|
+
The items must be `<webwriter-pairing-item>` children of this element.
|
|
692
|
+
|
|
693
|
+
### Usage
|
|
694
|
+
|
|
695
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
696
|
+
```html
|
|
697
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-pairing.css" rel="stylesheet">
|
|
698
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-pairing.js"></script>
|
|
699
|
+
<webwriter-pairing></webwriter-pairing>
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
703
|
+
|
|
704
|
+
```
|
|
705
|
+
npm install @webwriter/quiz
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
```html
|
|
709
|
+
<link href="@webwriter/quiz/widgets/webwriter-pairing.css" rel="stylesheet">
|
|
710
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-pairing.js"></script>
|
|
711
|
+
<webwriter-pairing></webwriter-pairing>
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
## Fields
|
|
715
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
716
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
717
|
+
| `mode` (`mode`) | `PairingMode` | How learners match the items.<br><br>- `pairing`: All items are visible and learners drag them together.<br>- `memory`: The items are face down and learners uncover two at a time. | `"pairing"` | ✓ |
|
|
718
|
+
| `solution` (`solution`) | `[string, string][]` | The pairs counting as correct, as tuples of the two item IDs. It is obfuscated in the markup so that learners cannot read it directly. | `[]` | ✓ |
|
|
719
|
+
|
|
720
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
721
|
+
|
|
722
|
+
## Methods
|
|
723
|
+
| Name | Description | Parameters |
|
|
724
|
+
| :--: | :---------: | :-------: |
|
|
725
|
+
| `checkValidity` | - | -
|
|
726
|
+
| `checkAnswer` | - | `detailedFeedback: boolean`
|
|
727
|
+
| `reset` | - | -
|
|
728
|
+
|
|
729
|
+
*[Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions) allow programmatic access to the widget.*
|
|
730
|
+
|
|
731
|
+
## Editing config
|
|
732
|
+
| Name | Value |
|
|
733
|
+
| :--: | :---------: |
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
737
|
+
|
|
738
|
+
*No public slots, events, custom CSS properties, or CSS parts.*
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
## `WebwriterPairing` (`<webwriter-pairing-item>`)
|
|
742
|
+
A single item of a `<webwriter-pairing>`.
|
|
743
|
+
|
|
744
|
+
It must be a child of its parent element.
|
|
745
|
+
|
|
746
|
+
### Usage
|
|
747
|
+
|
|
748
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
749
|
+
```html
|
|
750
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-pairing-item.css" rel="stylesheet">
|
|
751
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/quiz/widgets/webwriter-pairing-item.js"></script>
|
|
752
|
+
<webwriter-pairing-item></webwriter-pairing-item>
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
756
|
+
|
|
757
|
+
```
|
|
758
|
+
npm install @webwriter/quiz
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
```html
|
|
762
|
+
<link href="@webwriter/quiz/widgets/webwriter-pairing-item.css" rel="stylesheet">
|
|
763
|
+
<script type="module" src="@webwriter/quiz/widgets/webwriter-pairing-item.js"></script>
|
|
764
|
+
<webwriter-pairing-item></webwriter-pairing-item>
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
## Editing config
|
|
768
|
+
| Name | Value |
|
|
769
|
+
| :--: | :---------: |
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
773
|
+
|
|
774
|
+
*No public fields, methods, slots, events, custom CSS properties, or CSS parts.*
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
---
|
|
778
|
+
*Generated with @webwriter/build@1.9.1*
|