@webwriter/quiz 1.0.5 → 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.
Files changed (128) hide show
  1. package/LICENSE +6 -6
  2. package/custom.d.ts +175 -175
  3. package/dist/widgets/webwriter-choice-item.css +1 -1
  4. package/dist/widgets/webwriter-choice-item.js +1886 -802
  5. package/dist/widgets/webwriter-choice.css +1 -1
  6. package/dist/widgets/webwriter-choice.js +1943 -846
  7. package/dist/widgets/webwriter-cloze-gap.css +1 -1
  8. package/dist/widgets/webwriter-cloze-gap.js +1988 -902
  9. package/dist/widgets/webwriter-cloze.css +1 -1
  10. package/dist/widgets/webwriter-cloze.js +1833 -748
  11. package/dist/widgets/webwriter-mark.css +1 -1
  12. package/dist/widgets/webwriter-mark.js +1848 -762
  13. package/dist/widgets/webwriter-order-item.css +1 -1
  14. package/dist/widgets/webwriter-order-item.js +1884 -799
  15. package/dist/widgets/webwriter-order.css +1 -1
  16. package/dist/widgets/webwriter-order.js +1882 -790
  17. package/dist/widgets/webwriter-pairing-item.css +1 -1
  18. package/dist/widgets/webwriter-pairing-item.js +1718 -614
  19. package/dist/widgets/webwriter-pairing.css +1 -1
  20. package/dist/widgets/webwriter-pairing.js +1873 -781
  21. package/dist/widgets/webwriter-quiz.css +1 -1
  22. package/dist/widgets/webwriter-quiz.js +2241 -1026
  23. package/dist/widgets/webwriter-speech.css +1 -1
  24. package/dist/widgets/webwriter-speech.js +2179 -961
  25. package/dist/widgets/webwriter-task-explainer.css +1 -1
  26. package/dist/widgets/webwriter-task-explainer.js +1704 -600
  27. package/dist/widgets/webwriter-task-hint.css +1 -1
  28. package/dist/widgets/webwriter-task-hint.js +1695 -591
  29. package/dist/widgets/webwriter-task-prompt.css +1 -1
  30. package/dist/widgets/webwriter-task-prompt.js +1670 -566
  31. package/dist/widgets/webwriter-task.css +1 -1
  32. package/dist/widgets/webwriter-task.js +2361 -1143
  33. package/dist/widgets/webwriter-text.css +1 -1
  34. package/dist/widgets/webwriter-text.js +1876 -770
  35. package/icon.svg +1 -0
  36. package/lit-localize.json +15 -0
  37. package/localization/bg.xlf +54 -0
  38. package/localization/cs.xlf +54 -0
  39. package/localization/da.xlf +54 -0
  40. package/localization/de.xlf +54 -0
  41. package/localization/el.xlf +54 -0
  42. package/localization/es.xlf +54 -0
  43. package/localization/et.xlf +54 -0
  44. package/localization/fi.xlf +54 -0
  45. package/localization/fr.xlf +54 -0
  46. package/localization/generated/bg.ts +25 -0
  47. package/localization/generated/cs.ts +25 -0
  48. package/localization/generated/da.ts +25 -0
  49. package/localization/generated/de.ts +25 -0
  50. package/localization/generated/el.ts +25 -0
  51. package/localization/generated/es.ts +25 -0
  52. package/localization/generated/et.ts +25 -0
  53. package/localization/generated/fi.ts +25 -0
  54. package/localization/generated/fr.ts +25 -0
  55. package/localization/generated/hu.ts +25 -0
  56. package/localization/generated/id.ts +25 -0
  57. package/localization/generated/index.js +3 -0
  58. package/localization/generated/it.ts +25 -0
  59. package/localization/generated/ja.ts +25 -0
  60. package/localization/generated/ko.ts +25 -0
  61. package/localization/generated/locale-codes.js +79 -0
  62. package/localization/generated/lt.ts +25 -0
  63. package/localization/generated/lv.ts +25 -0
  64. package/localization/generated/nb.ts +25 -0
  65. package/localization/generated/nl.ts +25 -0
  66. package/localization/generated/pl.ts +25 -0
  67. package/localization/generated/pt-BR.ts +25 -0
  68. package/localization/generated/pt-PT.ts +25 -0
  69. package/localization/generated/ro.ts +25 -0
  70. package/localization/generated/ru.ts +25 -0
  71. package/localization/generated/sk.ts +25 -0
  72. package/localization/generated/sl.ts +25 -0
  73. package/localization/generated/sv.ts +25 -0
  74. package/localization/generated/tr.ts +25 -0
  75. package/localization/generated/uk.ts +25 -0
  76. package/localization/generated/zh-hans.ts +25 -0
  77. package/localization/hu.xlf +54 -0
  78. package/localization/id.xlf +54 -0
  79. package/localization/it.xlf +54 -0
  80. package/localization/ja.xlf +54 -0
  81. package/localization/ko.xlf +54 -0
  82. package/localization/lt.xlf +54 -0
  83. package/localization/lv.xlf +54 -0
  84. package/localization/nb.xlf +54 -0
  85. package/localization/nl.xlf +54 -0
  86. package/localization/pl.xlf +54 -0
  87. package/localization/pt-BR.xlf +54 -0
  88. package/localization/pt-PT.xlf +54 -0
  89. package/localization/ro.xlf +54 -0
  90. package/localization/ru.xlf +54 -0
  91. package/localization/sk.xlf +54 -0
  92. package/localization/sl.xlf +54 -0
  93. package/localization/sv.xlf +54 -0
  94. package/localization/tr.xlf +54 -0
  95. package/localization/uk.xlf +54 -0
  96. package/localization/zh-hans.xlf +54 -0
  97. package/package.json +206 -198
  98. package/src/lib/combobox.ts +455 -455
  99. package/src/lib/highlighter-fill.svg +5 -5
  100. package/src/snippets/Beispiel-Choice.html +57 -0
  101. package/src/snippets/Beispiel-Mark.html +14 -0
  102. package/src/snippets/Beispiel-Order.html +52 -0
  103. package/src/snippets/Beispiel-Text.html +20 -0
  104. package/src/snippets/choice.html +7 -7
  105. package/src/snippets/cloze.html +3 -3
  106. package/src/snippets/mark.html +3 -3
  107. package/src/snippets/order.html +7 -7
  108. package/src/snippets/pairing.html +9 -9
  109. package/src/snippets/speech.html +3 -3
  110. package/src/snippets/text.html +3 -3
  111. package/src/snippets/wordsearch.html +3 -3
  112. package/src/widgets/webwriter-choice-item.ts +250 -250
  113. package/src/widgets/webwriter-choice.ts +314 -309
  114. package/src/widgets/webwriter-cloze-gap.ts +215 -216
  115. package/src/widgets/webwriter-cloze.ts +135 -135
  116. package/src/widgets/webwriter-mark.ts +431 -434
  117. package/src/widgets/webwriter-order-item.ts +437 -436
  118. package/src/widgets/webwriter-order.ts +284 -279
  119. package/src/widgets/webwriter-pairing-item.ts +160 -155
  120. package/src/widgets/webwriter-pairing.ts +192 -187
  121. package/src/widgets/webwriter-quiz.ts +281 -280
  122. package/src/widgets/webwriter-speech.ts +272 -267
  123. package/src/widgets/webwriter-task-explainer.ts +42 -37
  124. package/src/widgets/webwriter-task-hint.ts +22 -16
  125. package/src/widgets/webwriter-task-prompt.ts +23 -17
  126. package/src/widgets/webwriter-task.ts +546 -543
  127. package/src/widgets/webwriter-text.ts +135 -130
  128. package/tsconfig.json +6 -6
@@ -1,131 +1,136 @@
1
- import {html, css} from "lit"
2
- import {LitElementWw, option} from "@webwriter/lit"
3
- import {customElement, property, query} from "lit/decorators.js"
4
- import {ifDefined} from "lit/directives/if-defined.js"
5
-
6
- import SlTextarea from "@shoelace-style/shoelace/dist/components/textarea/textarea.component.js"
7
- import SlInput from "@shoelace-style/shoelace/dist/components/input/input.component.js"
8
- import "@shoelace-style/shoelace/dist/themes/light.css"
9
-
10
- declare global {interface HTMLElementTagNameMap {
11
- "webwriter-text": WebwriterText;
12
- }}
13
-
14
- @customElement("webwriter-text")
15
- export class WebwriterText extends LitElementWw {
16
-
17
- @property({type: String, attribute: true, reflect: true})
18
- @option({
19
- type: "select",
20
- label: {"en": "Type", "de": "Typ"},
21
- options: [
22
- {value: "long-text", label: {"en": "Long Text", "de": "Langer Text"}},
23
- {value: "text", label: {"en": "Short Text", "de": "Kurzer Text"}},
24
- {value: "number", label: {"en": "Number", "de": "Zahl"}},
25
- {value: "date", label: {"en": "Date", "de": "Datum"}},
26
- {value: "time", label: {"en": "Time", "de": "Uhrzeit"}},
27
- {value: "datetime-local", label: {"en": "Date & Time", "de": "Datum & Uhrzeit"}}
28
- ]
29
- })
30
- accessor type: "date" | "datetime-local" | "number" | "text" | "time" | "long-text" = "long-text"
31
-
32
- @property({type: String, attribute: true, reflect: true})
33
- @option()
34
- accessor placeholder: string
35
-
36
- @property({type: String, attribute: true, reflect: true})
37
- accessor value: string
38
-
39
- /*
40
- @property({type: Number, attribute: true, reflect: true})
41
- @option({type: Number})
42
- min: number
43
-
44
- @property({type: Number, attribute: true, reflect: true})
45
- @option({type: Number})
46
- max: number
47
-
48
- @property({type: Number, attribute: true, reflect: true})
49
- @option({type: Number})
50
- step: number
51
- */
52
-
53
- static scopedElements = {
54
- "sl-textarea": SlTextarea,
55
- "sl-input": SlInput
56
- }
57
-
58
- static styles = css`
59
- :host(:is([contenteditable=true], [contenteditable=""])) sl-textarea::part(textarea) {
60
- color: var(--sl-color-success-700);
61
- }
62
-
63
- sl-textarea {
64
- resize: vertical;
65
- overflow: hidden;
66
- min-height: 40px;
67
-
68
- &::part(form-control), &::part(form-control-input), &::part(base), &::part(textarea) {
69
- height: 100%;
70
- }
71
- }
72
-
73
- :is(sl-textarea, sl-input)[data-correct]::part(base) {
74
- background: var(--sl-color-success-200);
75
- }
76
-
77
- #solution {
78
- padding: 1rem;
79
- }
80
-
81
- #solution[data-correct] {
82
- background: var(--sl-color-success-200);
83
- }
84
-
85
- #solution:not([data-correct]) {
86
- background: var(--sl-color-danger-200);
87
- }
88
- `
89
-
90
- handleChange = (e: CustomEvent) => {
91
- const target = e.target as SlTextarea | SlInput
92
- if(this.isContentEditable) {
93
- this.solution = target.value?.trim()
94
- }
95
- else {
96
- this.value = target.value?.trim()
97
- }
98
- this.dispatchEvent(new CustomEvent("ww-answer-change", {
99
- detail: {value: target.value},
100
- bubbles: true,
101
- composed: true
102
- }))
103
- }
104
-
105
- @query("sl-textarea, sl-input")
106
- accessor input: SlTextarea | SlInput
107
-
108
- focus() {
109
- this.input.focus()
110
- }
111
-
112
- reset() {
113
- this.solution = undefined
114
- this.input.value = ""
115
- }
116
-
117
- reportSolution() {}
118
-
119
- @property({type: String, attribute: false, reflect: false})
120
- accessor solution: string
121
-
122
- render() {
123
- const correct = this.solution && this.value?.trim() === this.solution
124
- const textarea = html`<sl-textarea ?data-correct=${correct} value=${this.isContentEditable? this.solution: this.value} placeholder=${this.placeholder} resize="none" @sl-change=${this.handleChange}></sl-textarea>`
125
- const input = html`<sl-input ?data-correct=${correct} value=${this.isContentEditable? this.solution: this.value} placeholder=${this.placeholder} type=${this.type} @sl-change=${this.handleChange}></sl-input>`
126
- return html`
127
- ${this.type === "long-text"? textarea: input}
128
- ${this.solution && !this.isContentEditable && !correct? html`<div id="solution" ?data-correct=${correct}>${this.solution}</div>`: undefined}
129
- `
130
- }
1
+ import {html, css} from "lit"
2
+ import {LitElementWw, option} from "@webwriter/lit"
3
+ import {customElement, property, query} from "lit/decorators.js"
4
+ import {ifDefined} from "lit/directives/if-defined.js"
5
+
6
+ import SlTextarea from "@shoelace-style/shoelace/dist/components/textarea/textarea.component.js"
7
+ import SlInput from "@shoelace-style/shoelace/dist/components/input/input.component.js"
8
+ import "@shoelace-style/shoelace/dist/themes/light.css"
9
+
10
+ import LOCALIZE from "../../localization/generated"
11
+ import {msg} from "@lit/localize"
12
+
13
+ declare global {interface HTMLElementTagNameMap {
14
+ "webwriter-text": WebwriterText;
15
+ }}
16
+
17
+ @customElement("webwriter-text")
18
+ export class WebwriterText extends LitElementWw {
19
+
20
+ localize = LOCALIZE
21
+
22
+ @property({type: String, attribute: true, reflect: true})
23
+ @option({
24
+ type: "select",
25
+ label: {"en": "Type", "de": "Typ"},
26
+ options: [
27
+ {value: "long-text", label: {"en": "Long Text", "de": "Langer Text"}},
28
+ {value: "text", label: {"en": "Short Text", "de": "Kurzer Text"}},
29
+ {value: "number", label: {"en": "Number", "de": "Zahl"}},
30
+ {value: "date", label: {"en": "Date", "de": "Datum"}},
31
+ {value: "time", label: {"en": "Time", "de": "Uhrzeit"}},
32
+ {value: "datetime-local", label: {"en": "Date & Time", "de": "Datum & Uhrzeit"}}
33
+ ]
34
+ })
35
+ accessor type: "date" | "datetime-local" | "number" | "text" | "time" | "long-text" = "long-text"
36
+
37
+ @property({type: String, attribute: true, reflect: true})
38
+ @option()
39
+ accessor placeholder: string
40
+
41
+ @property({type: String, attribute: true, reflect: true})
42
+ accessor value: string
43
+
44
+ /*
45
+ @property({type: Number, attribute: true, reflect: true})
46
+ @option({type: Number})
47
+ min: number
48
+
49
+ @property({type: Number, attribute: true, reflect: true})
50
+ @option({type: Number})
51
+ max: number
52
+
53
+ @property({type: Number, attribute: true, reflect: true})
54
+ @option({type: Number})
55
+ step: number
56
+ */
57
+
58
+ static scopedElements = {
59
+ "sl-textarea": SlTextarea,
60
+ "sl-input": SlInput
61
+ }
62
+
63
+ static styles = css`
64
+ :host(:is([contenteditable=true], [contenteditable=""])) sl-textarea::part(textarea) {
65
+ color: var(--sl-color-success-700);
66
+ }
67
+
68
+ sl-textarea {
69
+ resize: vertical;
70
+ overflow: hidden;
71
+ min-height: 40px;
72
+
73
+ &::part(form-control), &::part(form-control-input), &::part(base), &::part(textarea) {
74
+ height: 100%;
75
+ }
76
+ }
77
+
78
+ :is(sl-textarea, sl-input)[data-correct]::part(base) {
79
+ background: var(--sl-color-success-200);
80
+ }
81
+
82
+ #solution {
83
+ padding: 1rem;
84
+ }
85
+
86
+ #solution[data-correct] {
87
+ background: var(--sl-color-success-200);
88
+ }
89
+
90
+ #solution:not([data-correct]) {
91
+ background: var(--sl-color-danger-200);
92
+ }
93
+ `
94
+
95
+ handleChange = (e: CustomEvent) => {
96
+ const target = e.target as SlTextarea | SlInput
97
+ if(this.isContentEditable) {
98
+ this.solution = target.value?.trim()
99
+ }
100
+ else {
101
+ this.value = target.value?.trim()
102
+ }
103
+ this.dispatchEvent(new CustomEvent("ww-answer-change", {
104
+ detail: {value: target.value},
105
+ bubbles: true,
106
+ composed: true
107
+ }))
108
+ }
109
+
110
+ @query("sl-textarea, sl-input")
111
+ accessor input: SlTextarea | SlInput
112
+
113
+ focus() {
114
+ this.input.focus()
115
+ }
116
+
117
+ reset() {
118
+ this.solution = undefined
119
+ this.input.value = ""
120
+ }
121
+
122
+ reportSolution() {}
123
+
124
+ @property({type: String, attribute: false, reflect: false})
125
+ accessor solution: string
126
+
127
+ render() {
128
+ const correct = this.solution && this.value?.trim() === this.solution
129
+ const textarea = html`<sl-textarea ?data-correct=${correct} value=${this.isContentEditable? this.solution: this.value} placeholder=${this.placeholder} resize="none" @sl-change=${this.handleChange}></sl-textarea>`
130
+ const input = html`<sl-input ?data-correct=${correct} value=${this.isContentEditable? this.solution: this.value} placeholder=${this.placeholder} type=${this.type} @sl-change=${this.handleChange}></sl-input>`
131
+ return html`
132
+ ${this.type === "long-text"? textarea: input}
133
+ ${this.solution && !this.isContentEditable && !correct? html`<div id="solution" ?data-correct=${correct}>${this.solution}</div>`: undefined}
134
+ `
135
+ }
131
136
  }
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2022",
4
- "moduleResolution": "Bundler",
5
- "module": "ES2022"
6
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2022",
4
+ "moduleResolution": "Bundler",
5
+ "module": "ES2022"
6
+ }
7
7
  }