@webwriter/quiz 1.0.4 → 1.0.6
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 +6 -6
- package/custom.d.ts +175 -175
- package/dist/widgets/webwriter-choice-item.css +1 -1
- package/dist/widgets/webwriter-choice-item.js +1886 -802
- package/dist/widgets/webwriter-choice.css +1 -1
- package/dist/widgets/webwriter-choice.js +1943 -846
- package/dist/widgets/webwriter-cloze-gap.css +1 -1
- package/dist/widgets/webwriter-cloze-gap.js +1988 -902
- package/dist/widgets/webwriter-cloze.css +1 -1
- package/dist/widgets/webwriter-cloze.js +1833 -748
- package/dist/widgets/webwriter-mark.css +1 -1
- package/dist/widgets/webwriter-mark.js +1848 -762
- package/dist/widgets/webwriter-order-item.css +1 -1
- package/dist/widgets/webwriter-order-item.js +1884 -799
- package/dist/widgets/webwriter-order.css +1 -1
- package/dist/widgets/webwriter-order.js +1887 -2299
- package/dist/widgets/webwriter-pairing-item.css +1 -1
- package/dist/widgets/webwriter-pairing-item.js +1718 -614
- package/dist/widgets/webwriter-pairing.css +1 -1
- package/dist/widgets/webwriter-pairing.js +1873 -781
- package/dist/widgets/webwriter-quiz.css +1 -1
- package/dist/widgets/webwriter-quiz.js +2241 -1026
- package/dist/widgets/webwriter-speech.css +1 -1
- package/dist/widgets/webwriter-speech.js +2179 -961
- package/dist/widgets/webwriter-task-explainer.css +1 -1
- package/dist/widgets/webwriter-task-explainer.js +1704 -600
- package/dist/widgets/webwriter-task-hint.css +1 -1
- package/dist/widgets/webwriter-task-hint.js +1695 -591
- package/dist/widgets/webwriter-task-prompt.css +1 -1
- package/dist/widgets/webwriter-task-prompt.js +1670 -566
- package/dist/widgets/webwriter-task.css +1 -1
- package/dist/widgets/webwriter-task.js +2361 -1143
- package/dist/widgets/webwriter-text.css +1 -1
- package/dist/widgets/webwriter-text.js +1876 -770
- package/icon.svg +1 -0
- package/lit-localize.json +15 -0
- package/localization/bg.xlf +54 -0
- package/localization/cs.xlf +54 -0
- package/localization/da.xlf +54 -0
- package/localization/de.xlf +54 -0
- package/localization/el.xlf +54 -0
- package/localization/es.xlf +54 -0
- package/localization/et.xlf +54 -0
- package/localization/fi.xlf +54 -0
- package/localization/fr.xlf +54 -0
- package/localization/generated/bg.ts +25 -0
- package/localization/generated/cs.ts +25 -0
- package/localization/generated/da.ts +25 -0
- package/localization/generated/de.ts +25 -0
- package/localization/generated/el.ts +25 -0
- package/localization/generated/es.ts +25 -0
- package/localization/generated/et.ts +25 -0
- package/localization/generated/fi.ts +25 -0
- package/localization/generated/fr.ts +25 -0
- package/localization/generated/hu.ts +25 -0
- package/localization/generated/id.ts +25 -0
- package/localization/generated/index.js +3 -0
- package/localization/generated/it.ts +25 -0
- package/localization/generated/ja.ts +25 -0
- package/localization/generated/ko.ts +25 -0
- package/localization/generated/locale-codes.js +79 -0
- package/localization/generated/lt.ts +25 -0
- package/localization/generated/lv.ts +25 -0
- package/localization/generated/nb.ts +25 -0
- package/localization/generated/nl.ts +25 -0
- package/localization/generated/pl.ts +25 -0
- package/localization/generated/pt-BR.ts +25 -0
- package/localization/generated/pt-PT.ts +25 -0
- package/localization/generated/ro.ts +25 -0
- package/localization/generated/ru.ts +25 -0
- package/localization/generated/sk.ts +25 -0
- package/localization/generated/sl.ts +25 -0
- package/localization/generated/sv.ts +25 -0
- package/localization/generated/tr.ts +25 -0
- package/localization/generated/uk.ts +25 -0
- package/localization/generated/zh-hans.ts +25 -0
- package/localization/hu.xlf +54 -0
- package/localization/id.xlf +54 -0
- package/localization/it.xlf +54 -0
- package/localization/ja.xlf +54 -0
- package/localization/ko.xlf +54 -0
- package/localization/lt.xlf +54 -0
- package/localization/lv.xlf +54 -0
- package/localization/nb.xlf +54 -0
- package/localization/nl.xlf +54 -0
- package/localization/pl.xlf +54 -0
- package/localization/pt-BR.xlf +54 -0
- package/localization/pt-PT.xlf +54 -0
- package/localization/ro.xlf +54 -0
- package/localization/ru.xlf +54 -0
- package/localization/sk.xlf +54 -0
- package/localization/sl.xlf +54 -0
- package/localization/sv.xlf +54 -0
- package/localization/tr.xlf +54 -0
- package/localization/uk.xlf +54 -0
- package/localization/zh-hans.xlf +54 -0
- package/package.json +206 -198
- package/src/lib/combobox.ts +455 -455
- package/src/lib/highlighter-fill.svg +5 -5
- package/src/snippets/Beispiel-Choice.html +57 -0
- package/src/snippets/Beispiel-Mark.html +14 -0
- package/src/snippets/Beispiel-Order.html +52 -0
- package/src/snippets/Beispiel-Text.html +20 -0
- package/src/snippets/choice.html +7 -7
- package/src/snippets/cloze.html +3 -3
- package/src/snippets/mark.html +3 -3
- package/src/snippets/order.html +7 -7
- package/src/snippets/pairing.html +9 -9
- package/src/snippets/speech.html +3 -3
- package/src/snippets/text.html +3 -3
- package/src/snippets/wordsearch.html +3 -3
- package/src/widgets/webwriter-choice-item.ts +250 -250
- package/src/widgets/webwriter-choice.ts +314 -309
- package/src/widgets/webwriter-cloze-gap.ts +215 -216
- package/src/widgets/webwriter-cloze.ts +135 -135
- package/src/widgets/webwriter-mark.ts +431 -434
- package/src/widgets/webwriter-order-item.ts +437 -444
- package/src/widgets/webwriter-order.ts +284 -272
- package/src/widgets/webwriter-pairing-item.ts +160 -155
- package/src/widgets/webwriter-pairing.ts +192 -187
- package/src/widgets/webwriter-quiz.ts +281 -280
- package/src/widgets/webwriter-speech.ts +272 -267
- package/src/widgets/webwriter-task-explainer.ts +42 -37
- package/src/widgets/webwriter-task-hint.ts +22 -16
- package/src/widgets/webwriter-task-prompt.ts +23 -17
- package/src/widgets/webwriter-task.ts +546 -543
- package/src/widgets/webwriter-text.ts +135 -130
- package/tsconfig.json +6 -6
|
@@ -1,544 +1,547 @@
|
|
|
1
|
-
import {html, css, PropertyValues} from "lit"
|
|
2
|
-
import {styleMap} from "lit/directives/style-map.js"
|
|
3
|
-
import {LitElementWw, option} from "@webwriter/lit"
|
|
4
|
-
import {customElement, queryAssignedElements, property, query, queryAll} from "lit/decorators.js"
|
|
5
|
-
|
|
6
|
-
import SlIconButton from "@shoelace-style/shoelace/dist/components/icon-button/icon-button.component.js"
|
|
7
|
-
import SlButton from "@shoelace-style/shoelace/dist/components/button/button.component.js"
|
|
8
|
-
import SlDetails from "@shoelace-style/shoelace/dist/components/details/details.component.js"
|
|
9
|
-
import SlPopup from "@shoelace-style/shoelace/dist/components/popup/popup.component.js"
|
|
10
|
-
import SlButtonGroup from "@shoelace-style/shoelace/dist/components/button-group/button-group.component.js"
|
|
11
|
-
|
|
12
|
-
import SlTabGroup from "@shoelace-style/shoelace/dist/components/tab-group/tab-group.component.js"
|
|
13
|
-
import SlTab from "@shoelace-style/shoelace/dist/components/tab/tab.component.js"
|
|
14
|
-
import SlTabPanel from "@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.component.js"
|
|
15
|
-
|
|
16
|
-
import IconPatchQuestion from "bootstrap-icons/icons/patch-question.svg"
|
|
17
|
-
import IconPatchQuestionFill from "bootstrap-icons/icons/patch-question-fill.svg"
|
|
18
|
-
import IconPatchCheck from "bootstrap-icons/icons/patch-check.svg"
|
|
19
|
-
import IconPatchCheckFill from "bootstrap-icons/icons/patch-check-fill.svg"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
"sl-
|
|
120
|
-
"sl-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
z-index:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
:host(:not([contenteditable=true]):not([contenteditable=""]))
|
|
158
|
-
display: none;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
:host(:
|
|
162
|
-
display: none;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
:host(:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
#
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
&[data-
|
|
204
|
-
display: none;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
& sl-tab
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
&
|
|
232
|
-
display:
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
& #
|
|
243
|
-
flex-grow:
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
get
|
|
257
|
-
return this.hints.
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
this.ownerDocument.
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
get
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
@property({type: String, attribute:
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
@property({type: String, attribute:
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
let
|
|
394
|
-
let
|
|
395
|
-
let
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
@query("slot[name
|
|
444
|
-
accessor
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
this.
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
this.
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
<
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
1
|
+
import {html, css, PropertyValues} from "lit"
|
|
2
|
+
import {styleMap} from "lit/directives/style-map.js"
|
|
3
|
+
import {LitElementWw, option} from "@webwriter/lit"
|
|
4
|
+
import {customElement, queryAssignedElements, property, query, queryAll} from "lit/decorators.js"
|
|
5
|
+
|
|
6
|
+
import SlIconButton from "@shoelace-style/shoelace/dist/components/icon-button/icon-button.component.js"
|
|
7
|
+
import SlButton from "@shoelace-style/shoelace/dist/components/button/button.component.js"
|
|
8
|
+
import SlDetails from "@shoelace-style/shoelace/dist/components/details/details.component.js"
|
|
9
|
+
import SlPopup from "@shoelace-style/shoelace/dist/components/popup/popup.component.js"
|
|
10
|
+
import SlButtonGroup from "@shoelace-style/shoelace/dist/components/button-group/button-group.component.js"
|
|
11
|
+
|
|
12
|
+
import SlTabGroup from "@shoelace-style/shoelace/dist/components/tab-group/tab-group.component.js"
|
|
13
|
+
import SlTab from "@shoelace-style/shoelace/dist/components/tab/tab.component.js"
|
|
14
|
+
import SlTabPanel from "@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.component.js"
|
|
15
|
+
|
|
16
|
+
import IconPatchQuestion from "bootstrap-icons/icons/patch-question.svg"
|
|
17
|
+
import IconPatchQuestionFill from "bootstrap-icons/icons/patch-question-fill.svg"
|
|
18
|
+
import IconPatchCheck from "bootstrap-icons/icons/patch-check.svg"
|
|
19
|
+
import IconPatchCheckFill from "bootstrap-icons/icons/patch-check-fill.svg"
|
|
20
|
+
|
|
21
|
+
import "@shoelace-style/shoelace/dist/themes/light.css"
|
|
22
|
+
import { WebwriterTaskExplainer } from "./webwriter-task-explainer"
|
|
23
|
+
|
|
24
|
+
import LOCALIZE from "../../localization/generated"
|
|
25
|
+
import {msg} from "@lit/localize"
|
|
26
|
+
|
|
27
|
+
async function arrayBufferToDataUrl(buffer: ArrayBuffer | Uint8Array) {
|
|
28
|
+
return new Promise(r => {
|
|
29
|
+
const reader = new FileReader()
|
|
30
|
+
reader.onload = () => r(reader.result as string)
|
|
31
|
+
reader.readAsDataURL(new Blob([buffer]))
|
|
32
|
+
}) as Promise<string>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function dataUrlToArrayBuffer(url: string) {
|
|
36
|
+
return await (await (await fetch(url)).blob()).arrayBuffer()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function getKeyMaterial(password: string) {
|
|
40
|
+
let enc = new TextEncoder();
|
|
41
|
+
return window.crypto.subtle.importKey(
|
|
42
|
+
"raw",
|
|
43
|
+
enc.encode(password),
|
|
44
|
+
{name: "PBKDF2"},
|
|
45
|
+
false,
|
|
46
|
+
["deriveBits", "deriveKey"]
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function getKey(keyMaterial: CryptoKey, salt: ArrayBufferView) {
|
|
51
|
+
return window.crypto.subtle.deriveKey(
|
|
52
|
+
{
|
|
53
|
+
"name": "PBKDF2",
|
|
54
|
+
salt: salt,
|
|
55
|
+
"iterations": 100000,
|
|
56
|
+
"hash": "SHA-256"
|
|
57
|
+
},
|
|
58
|
+
keyMaterial,
|
|
59
|
+
{ "name": "AES-GCM", "length": 256},
|
|
60
|
+
true,
|
|
61
|
+
[ "encrypt", "decrypt" ]
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function romanOrdinal(num: number, capitalize=false) {
|
|
66
|
+
let roman = {
|
|
67
|
+
m: 1000,
|
|
68
|
+
cm: 900,
|
|
69
|
+
d: 500,
|
|
70
|
+
cd: 400,
|
|
71
|
+
c: 100,
|
|
72
|
+
xc: 90,
|
|
73
|
+
l: 50,
|
|
74
|
+
xl: 40,
|
|
75
|
+
x: 10,
|
|
76
|
+
ix: 9,
|
|
77
|
+
v: 5,
|
|
78
|
+
iv: 4,
|
|
79
|
+
i: 1
|
|
80
|
+
};
|
|
81
|
+
let str = ''
|
|
82
|
+
|
|
83
|
+
for (let i of Object.keys(roman)) {
|
|
84
|
+
let q = Math.floor(num / roman[i])
|
|
85
|
+
num -= q * roman[i]
|
|
86
|
+
str += i.repeat(q)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return capitalize? str.toUpperCase(): str
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function alphabeticalOrdinal(num: number, capitalize=false, alphabet="abcdefghijklmnopqrstuvwxyz") {
|
|
93
|
+
const a = alphabet[0]
|
|
94
|
+
const k = alphabet.length
|
|
95
|
+
const str = a.repeat(Math.floor(num / k)) + alphabet[num % k]
|
|
96
|
+
return capitalize? str.toUpperCase(): str
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
interface Answer {
|
|
102
|
+
solution: any
|
|
103
|
+
reportSolution(): void
|
|
104
|
+
reset(): void
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare global {interface HTMLElementTagNameMap {
|
|
108
|
+
"webwriter-task": WebwriterTask;
|
|
109
|
+
}}
|
|
110
|
+
|
|
111
|
+
@customElement("webwriter-task")
|
|
112
|
+
export class WebwriterTask extends LitElementWw {
|
|
113
|
+
|
|
114
|
+
localize = LOCALIZE
|
|
115
|
+
|
|
116
|
+
static localization = {}
|
|
117
|
+
|
|
118
|
+
static scopedElements = {
|
|
119
|
+
"sl-icon-button": SlIconButton,
|
|
120
|
+
"sl-details": SlDetails,
|
|
121
|
+
"sl-popup": SlPopup,
|
|
122
|
+
"sl-button": SlButton,
|
|
123
|
+
"sl-button-group": SlButtonGroup,
|
|
124
|
+
"sl-tab-group": SlTabGroup,
|
|
125
|
+
"sl-tab": SlTab,
|
|
126
|
+
"sl-tab-panel": SlTabPanel
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
static styles = css`
|
|
130
|
+
:host {
|
|
131
|
+
display: flex !important;
|
|
132
|
+
flex-direction: column;
|
|
133
|
+
gap: 1rem;
|
|
134
|
+
position: relative;
|
|
135
|
+
z-index: 1;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
:host(:not([hint])) details {
|
|
140
|
+
display: none;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
sl-tooltip::part(base__popup) {
|
|
144
|
+
cursor: text;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
#hint-popup {
|
|
148
|
+
--arrow-color: var(--sl-color-neutral-700);
|
|
149
|
+
z-index: 1000;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
#hint-popup::part(popup) {
|
|
153
|
+
z-index: 100;
|
|
154
|
+
max-width: 200px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
:host(:not([contenteditable=true]):not([contenteditable=""]):not([hint])) #hint {
|
|
158
|
+
display: none;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
:host(:not([contenteditable=true]):not([contenteditable=""])) .author-only {
|
|
162
|
+
display: none;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:host(:is([contenteditable=true], [contenteditable=""])) .user-only {
|
|
166
|
+
display: none;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:host(:not([contenteditable=true]):not([contenteditable=""])) {
|
|
170
|
+
::slotted([slot=prompt]:empty) {
|
|
171
|
+
display: none;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
:host(:not([submitted]):not([contenteditable=true]):not([contenteditable=""])) #explainer-group {
|
|
176
|
+
display: none;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
#task-buttons {
|
|
180
|
+
position: absolute;
|
|
181
|
+
right: 0;
|
|
182
|
+
top: 0;
|
|
183
|
+
background: rgba(255, 255, 255, 0.9);
|
|
184
|
+
user-select: none;
|
|
185
|
+
z-index: 100;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
#hint-content {
|
|
189
|
+
background: var(--sl-color-neutral-700);
|
|
190
|
+
color: var(--sl-color-neutral-50);
|
|
191
|
+
min-width: 2ch;
|
|
192
|
+
font-size: 0.75rem;
|
|
193
|
+
padding: 0.5rem;
|
|
194
|
+
border-radius: 4px;
|
|
195
|
+
user-select: auto;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
::slotted([slot=explainer]:not([active])) {
|
|
199
|
+
display: none !important;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
sl-tab-group {
|
|
203
|
+
&[data-empty] {
|
|
204
|
+
display: none;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
&[data-single] sl-tab {
|
|
208
|
+
display: none;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
& sl-tab::part(base) {
|
|
212
|
+
padding: 10px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
&::part(tabs) {
|
|
216
|
+
height: 100px;
|
|
217
|
+
margin-left: -1px;
|
|
218
|
+
z-index: 10;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
& ::slotted([name=explainer]) {
|
|
222
|
+
height: 100%;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
header {
|
|
227
|
+
display: flex;
|
|
228
|
+
flex-direction: row;
|
|
229
|
+
gap: 1ch;
|
|
230
|
+
|
|
231
|
+
& span:empty {
|
|
232
|
+
display: none;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
& slot {
|
|
236
|
+
display: block;
|
|
237
|
+
flex-grow: 1;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.user-actions {
|
|
242
|
+
& #submit {
|
|
243
|
+
flex-grow: 3;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
& #reset {
|
|
247
|
+
flex-grow: 1;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
`
|
|
252
|
+
|
|
253
|
+
@queryAssignedElements({slot: "hint"})
|
|
254
|
+
accessor hints: HTMLElement[]
|
|
255
|
+
|
|
256
|
+
get hasHintElement() {
|
|
257
|
+
return this.hints.length > 0
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
get hasHintContent() {
|
|
261
|
+
return this.hints.some(hint => hint.innerText.trim() !== "")
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
@property({type: Boolean, attribute: true, reflect: true})
|
|
265
|
+
accessor hint = false
|
|
266
|
+
|
|
267
|
+
@property({type: Boolean, state: true, attribute: false, reflect: false})
|
|
268
|
+
accessor isChanged = false
|
|
269
|
+
|
|
270
|
+
get directSubmit() {
|
|
271
|
+
return !this.closest("webwriter-quiz")
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
@property({type: Boolean, attribute: false, reflect: true})
|
|
275
|
+
private set directSubmit(value: boolean) {
|
|
276
|
+
return
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
@property({type: Boolean, attribute: true, reflect: true})
|
|
280
|
+
accessor submitted = false
|
|
281
|
+
|
|
282
|
+
toggleHint() {
|
|
283
|
+
this.hintOpen = !this.hintOpen
|
|
284
|
+
if(this.isContentEditable && this.hintOpen) {
|
|
285
|
+
this.hint = true
|
|
286
|
+
if(!this.hasHintElement) {
|
|
287
|
+
const hintEl = this.ownerDocument.createElement("webwriter-task-hint")
|
|
288
|
+
hintEl.slot = "hint"
|
|
289
|
+
this.answer.insertAdjacentElement("beforebegin", hintEl)
|
|
290
|
+
this.ownerDocument.getSelection().setBaseAndExtent(hintEl, 0, hintEl, 0)
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
else if(this.isContentEditable && !this.hintOpen) {
|
|
294
|
+
if(!this.hasHintContent) {
|
|
295
|
+
this.hint = false
|
|
296
|
+
this.hintSlotEl.assignedElements().forEach(el => el.remove())
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
get explainers(): WebwriterTaskExplainer[] {
|
|
302
|
+
return Array.from(this.querySelectorAll("webwriter-task-explainer")) as unknown as WebwriterTaskExplainer[]
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
toggleExplainers = () => {
|
|
306
|
+
if(this.explainers.length) {
|
|
307
|
+
this.explainers.forEach(explainer => explainer.remove())
|
|
308
|
+
this.activeExplainer = undefined
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
const solutionExplainer = this.ownerDocument.createElement("webwriter-task-explainer")
|
|
312
|
+
solutionExplainer.slot = "explainer"
|
|
313
|
+
solutionExplainer.id = "solution"
|
|
314
|
+
solutionExplainer.active = true/*
|
|
315
|
+
const elseExplainer = this.ownerDocument.createElement("webwriter-task-explainer")
|
|
316
|
+
elseExplainer.slot = "explainer"
|
|
317
|
+
elseExplainer.id = "else"*/
|
|
318
|
+
this.append(solutionExplainer)
|
|
319
|
+
this.ownerDocument.getSelection().setBaseAndExtent(solutionExplainer, 0, solutionExplainer, 0)
|
|
320
|
+
this.requestUpdate()
|
|
321
|
+
this.activeExplainer = "solution"
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
@property({attribute: false, state: true})
|
|
326
|
+
private accessor hintOpen = false
|
|
327
|
+
|
|
328
|
+
@property({attribute: true, reflect: true})
|
|
329
|
+
accessor counter: "number" | "roman" | "roman-capitalized" | "alphabetical" | "alphabetical-capitalized"
|
|
330
|
+
|
|
331
|
+
get index() {
|
|
332
|
+
return [...(this?.parentElement?.children ?? [])].indexOf(this)
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
get ordinalExpr() {
|
|
336
|
+
if(this.index === undefined || this.index === -1) {
|
|
337
|
+
return undefined
|
|
338
|
+
}
|
|
339
|
+
if(this.counter === "number") {
|
|
340
|
+
return `${this.index + 1}.`
|
|
341
|
+
}
|
|
342
|
+
else if(this.counter === "roman") {
|
|
343
|
+
return `${romanOrdinal(this.index + 1)}.`
|
|
344
|
+
}
|
|
345
|
+
else if(this.counter === "roman-capitalized") {
|
|
346
|
+
return `${romanOrdinal(this.index + 1, true)}.`
|
|
347
|
+
}
|
|
348
|
+
else if(this.counter === "alphabetical") {
|
|
349
|
+
return `${alphabeticalOrdinal(this.index)}.`
|
|
350
|
+
}
|
|
351
|
+
else if(this.counter === "alphabetical-capitalized") {
|
|
352
|
+
return `${alphabeticalOrdinal(this.index, true)}.`
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
observer: MutationObserver
|
|
357
|
+
|
|
358
|
+
connectedCallback(): void {
|
|
359
|
+
super.connectedCallback()
|
|
360
|
+
this.observer = new MutationObserver(() => this.requestUpdate())
|
|
361
|
+
this.parentElement && this.observer.observe(this.parentElement, {childList: true})
|
|
362
|
+
this.addEventListener("keydown", (e) => this.handleHintKeydown(e))
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
protected firstUpdated(_changedProperties: PropertyValues): void {
|
|
366
|
+
if(this.isContentEditable) {
|
|
367
|
+
this.#decodeSolution()
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
disconnectedCallback(): void {
|
|
373
|
+
super.disconnectedCallback()
|
|
374
|
+
this.observer.disconnect()
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
@property({type: String, attribute: true, reflect: true})
|
|
378
|
+
accessor solution: string
|
|
379
|
+
|
|
380
|
+
/** Property containing the password currently entered by the author or user */
|
|
381
|
+
@property({type: String, attribute: false, reflect: false})
|
|
382
|
+
// @option({type: String, label: {_: "Password"}, description: {_: "Password-protects quiz answers"}})
|
|
383
|
+
accessor password: string = "B08bxd82SAOf"
|
|
384
|
+
|
|
385
|
+
@property({type: String, attribute: true, reflect: true})
|
|
386
|
+
accessor salt: string
|
|
387
|
+
|
|
388
|
+
@property({type: String, attribute: true, reflect: true})
|
|
389
|
+
accessor iv: string
|
|
390
|
+
|
|
391
|
+
async #encodeSolution() {
|
|
392
|
+
const value = this.answer.solution as any
|
|
393
|
+
let keyMaterial = await getKeyMaterial(this.password)
|
|
394
|
+
let salt = window.crypto.getRandomValues(new Uint8Array(16))
|
|
395
|
+
let iv = window.crypto.getRandomValues(new Uint8Array(12))
|
|
396
|
+
let key = await getKey(keyMaterial, salt)
|
|
397
|
+
let encoder = new TextEncoder();
|
|
398
|
+
let encodedMessage = encoder.encode(JSON.stringify(value))
|
|
399
|
+
const solution = await window.crypto.subtle.encrypt(
|
|
400
|
+
{name: "AES-GCM", iv},
|
|
401
|
+
key,
|
|
402
|
+
encodedMessage
|
|
403
|
+
)
|
|
404
|
+
|
|
405
|
+
this.solution = await arrayBufferToDataUrl(solution)
|
|
406
|
+
this.iv = await arrayBufferToDataUrl(iv)
|
|
407
|
+
this.salt = await arrayBufferToDataUrl(salt)
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
async #decodeSolution() {
|
|
411
|
+
if(!this.solution) {
|
|
412
|
+
return
|
|
413
|
+
}
|
|
414
|
+
const encodedSolution = await dataUrlToArrayBuffer(this.solution)
|
|
415
|
+
const iv = await dataUrlToArrayBuffer(this.iv)
|
|
416
|
+
const salt = await dataUrlToArrayBuffer(this.salt)
|
|
417
|
+
let keyMaterial = await getKeyMaterial(this.password)
|
|
418
|
+
let key = await getKey(keyMaterial, new Uint8Array(salt))
|
|
419
|
+
try {
|
|
420
|
+
const solutionBuffer = await window.crypto.subtle.decrypt({name: "AES-GCM", iv}, key, encodedSolution)
|
|
421
|
+
let decoder = new TextDecoder()
|
|
422
|
+
const solution = JSON.parse(decoder.decode(solutionBuffer))
|
|
423
|
+
this.answer.solution = solution
|
|
424
|
+
}
|
|
425
|
+
catch(err) {
|
|
426
|
+
console.error(err)
|
|
427
|
+
throw new Error("Invalid password")
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
checkSolution() {
|
|
432
|
+
const solution = this.#decodeSolution()
|
|
433
|
+
return Object.entries(solution).every(([k, v]) => {
|
|
434
|
+
return JSON.stringify(this.answer[k]) === JSON.stringify(v)
|
|
435
|
+
})
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
reportSolution() {
|
|
439
|
+
// @ts-ignore
|
|
440
|
+
this.answer.reportSolution(this.#decodeSolution())
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
@query("slot:not([name])")
|
|
444
|
+
accessor slotEl: HTMLSlotElement
|
|
445
|
+
|
|
446
|
+
@query("slot[name=hint]")
|
|
447
|
+
accessor hintSlotEl: HTMLSlotElement
|
|
448
|
+
|
|
449
|
+
get answer() {
|
|
450
|
+
return this.slotEl?.assignedElements()[0] as HTMLElement
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
handleHintSlotChange = (e: Event) => {
|
|
456
|
+
if(!this.hasHintElement) {
|
|
457
|
+
this.hintOpen = false
|
|
458
|
+
this.hint = false
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
handleHintKeydown = (e: KeyboardEvent) => {
|
|
463
|
+
console.log(document.getSelection().anchorOffset === 0, this.hints.includes(document.getSelection().anchorNode.parentElement))
|
|
464
|
+
if(e.key === "Backspace" && document.getSelection().anchorOffset === 0 && this.hints.includes(document.getSelection().anchorNode.parentElement)) {
|
|
465
|
+
this.hintOpen = false
|
|
466
|
+
this.hint = false
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
handleSubmit = async () => {
|
|
471
|
+
await this.#decodeSolution()
|
|
472
|
+
this.answer.reportSolution()
|
|
473
|
+
this.dispatchEvent(new SubmitEvent("submit", {bubbles: true, composed: true}))
|
|
474
|
+
this.activeExplainer = this.explainers[0].id
|
|
475
|
+
this.submitted = true
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
handleReset = () => {
|
|
479
|
+
this.answer.reset && this.answer.reset()
|
|
480
|
+
this.isChanged = false
|
|
481
|
+
this.submitted = false
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
handleAnswerChange = async (e: CustomEvent) => {
|
|
485
|
+
this.isChanged = true
|
|
486
|
+
if(this.isContentEditable) {
|
|
487
|
+
this.#encodeSolution()
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
handleSlotChange = (e: Event) => {
|
|
492
|
+
this.requestUpdate()
|
|
493
|
+
if(this.isContentEditable) {
|
|
494
|
+
const solution = this.#decodeSolution() ?? {}
|
|
495
|
+
Object.entries(solution).forEach(([k, v]) => {
|
|
496
|
+
this.answer[k] = v
|
|
497
|
+
})
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
@property()
|
|
502
|
+
accessor activeExplainer: string
|
|
503
|
+
|
|
504
|
+
selectExplainer(id: string) {
|
|
505
|
+
const explainer = this.explainers.find(node => node.id === id)
|
|
506
|
+
explainer.active = true
|
|
507
|
+
this.explainers.filter(node => node.id !== id).forEach(node => node.active = false)
|
|
508
|
+
this.activeExplainer = id
|
|
509
|
+
setTimeout(() => this.ownerDocument.getSelection().setBaseAndExtent(explainer, 0, explainer, 0))
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
get explainerLabels() {
|
|
513
|
+
return {
|
|
514
|
+
"solution": "Explainer",
|
|
515
|
+
"else": "Else"
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
render() {
|
|
520
|
+
return html`
|
|
521
|
+
<header>
|
|
522
|
+
<span>${this.ordinalExpr}</span>
|
|
523
|
+
<slot name="prompt"></slot>
|
|
524
|
+
<div id="task-buttons">
|
|
525
|
+
<sl-icon-button class="author-only" id="feedback" src=${!this.explainers.length? IconPatchCheck: IconPatchCheckFill} @click=${() => this.toggleExplainers()}></sl-icon-button>
|
|
526
|
+
<sl-popup id="hint-popup" ?active=${this.hintOpen} placement="left" arrow auto-size shift @selectstart=${e => e.stopImmediatePropagation()}>
|
|
527
|
+
<sl-icon-button class="author-only" slot="anchor" id="hint" src=${!this.hasHintContent && !this.hintOpen? IconPatchQuestion: IconPatchQuestionFill} @click=${() => this.toggleHint()}></sl-icon-button>
|
|
528
|
+
<div id="hint-content">
|
|
529
|
+
<slot name="hint" @slotchange=${this.handleHintSlotChange}></slot>
|
|
530
|
+
</div>
|
|
531
|
+
</sl-popup>
|
|
532
|
+
</div>
|
|
533
|
+
</header>
|
|
534
|
+
<slot @ww-answer-change=${this.handleAnswerChange} @slotchange=${this.handleSlotChange} ?inert=${this.submitted}></slot>
|
|
535
|
+
<sl-tab-group id="explainer-group" placement="end" ?data-empty=${!this.explainers.length} ?data-single=${this.explainers.length === 1}>
|
|
536
|
+
${this.explainers.map((explainer, i) => html`<sl-tab ?active=${this.activeExplainer === explainer.id} slot="nav" @click=${() => this.selectExplainer(explainer.id)}>${this.explainerLabels[explainer.id] ?? explainer.id}</sl-tab>`)}
|
|
537
|
+
<slot name="explainer" style=${styleMap({"--ww-placeholder": `"${msg("Explanation")}"`})}></slot>
|
|
538
|
+
</sl-tab-group>
|
|
539
|
+
${!this.directSubmit || !this.answer?.reportSolution? null: html`
|
|
540
|
+
<sl-button-group class="user-only user-actions">
|
|
541
|
+
<sl-button id="submit" @click=${this.handleSubmit}>${msg("Check your answers")}</sl-button>
|
|
542
|
+
<sl-button ?disabled=${!this.isChanged && !this.submitted} id="reset" class="user-only" @click=${this.handleReset}>${msg("Try again")}</sl-button>
|
|
543
|
+
</sl-button-group>
|
|
544
|
+
`}
|
|
545
|
+
`
|
|
546
|
+
}
|
|
544
547
|
}
|