@webwriter/quiz 1.1.2 → 1.1.5

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 (112) hide show
  1. package/.github/workflows/publish.yml +8 -0
  2. package/LICENSE +6 -6
  3. package/custom.d.ts +175 -175
  4. package/dist/widgets/webwriter-choice-item.js +69 -205
  5. package/dist/widgets/webwriter-choice.js +99 -214
  6. package/dist/widgets/webwriter-cloze-gap.js +74 -213
  7. package/dist/widgets/webwriter-cloze.js +71 -204
  8. package/dist/widgets/webwriter-mark.js +72 -205
  9. package/dist/widgets/webwriter-order-item.js +68 -201
  10. package/dist/widgets/webwriter-order.js +99 -209
  11. package/dist/widgets/webwriter-pairing-item.js +57 -160
  12. package/dist/widgets/webwriter-pairing.js +69 -196
  13. package/dist/widgets/webwriter-quiz.js +72 -211
  14. package/dist/widgets/webwriter-speech.js +71 -204
  15. package/dist/widgets/webwriter-task-explainer.js +57 -160
  16. package/dist/widgets/webwriter-task-hint.js +55 -158
  17. package/dist/widgets/webwriter-task-prompt.js +61 -170
  18. package/dist/widgets/webwriter-task.js +80 -205
  19. package/dist/widgets/webwriter-text.js +94 -205
  20. package/lit-localize.json +14 -14
  21. package/localization/bg.xlf +72 -69
  22. package/localization/cs.xlf +72 -69
  23. package/localization/da.xlf +72 -69
  24. package/localization/de.xlf +77 -74
  25. package/localization/el.xlf +72 -69
  26. package/localization/es.xlf +72 -69
  27. package/localization/et.xlf +72 -69
  28. package/localization/fi.xlf +72 -69
  29. package/localization/fr.xlf +72 -69
  30. package/localization/generated/bg.ts +30 -29
  31. package/localization/generated/cs.ts +30 -29
  32. package/localization/generated/da.ts +30 -29
  33. package/localization/generated/de.ts +30 -29
  34. package/localization/generated/el.ts +30 -29
  35. package/localization/generated/es.ts +30 -29
  36. package/localization/generated/et.ts +30 -29
  37. package/localization/generated/fi.ts +30 -29
  38. package/localization/generated/fr.ts +30 -29
  39. package/localization/generated/hu.ts +30 -29
  40. package/localization/generated/id.ts +30 -29
  41. package/localization/generated/index.js +2 -2
  42. package/localization/generated/it.ts +30 -29
  43. package/localization/generated/ja.ts +30 -29
  44. package/localization/generated/ko.ts +30 -29
  45. package/localization/generated/locale-codes.js +79 -79
  46. package/localization/generated/lt.ts +30 -29
  47. package/localization/generated/lv.ts +30 -29
  48. package/localization/generated/nb.ts +30 -29
  49. package/localization/generated/nl.ts +30 -29
  50. package/localization/generated/pl.ts +30 -29
  51. package/localization/generated/pt-BR.ts +30 -29
  52. package/localization/generated/pt-PT.ts +30 -29
  53. package/localization/generated/ro.ts +30 -29
  54. package/localization/generated/ru.ts +30 -29
  55. package/localization/generated/sk.ts +30 -29
  56. package/localization/generated/sl.ts +30 -29
  57. package/localization/generated/sv.ts +30 -29
  58. package/localization/generated/tr.ts +30 -29
  59. package/localization/generated/uk.ts +30 -29
  60. package/localization/generated/zh-hans.ts +30 -29
  61. package/localization/hu.xlf +72 -69
  62. package/localization/id.xlf +72 -69
  63. package/localization/it.xlf +72 -69
  64. package/localization/ja.xlf +72 -69
  65. package/localization/ko.xlf +72 -69
  66. package/localization/lt.xlf +72 -69
  67. package/localization/lv.xlf +72 -69
  68. package/localization/nb.xlf +72 -69
  69. package/localization/nl.xlf +72 -69
  70. package/localization/pl.xlf +72 -69
  71. package/localization/pt-BR.xlf +72 -69
  72. package/localization/pt-PT.xlf +72 -69
  73. package/localization/ro.xlf +72 -69
  74. package/localization/ru.xlf +72 -69
  75. package/localization/sk.xlf +72 -69
  76. package/localization/sl.xlf +72 -69
  77. package/localization/sv.xlf +72 -69
  78. package/localization/tr.xlf +72 -69
  79. package/localization/uk.xlf +72 -69
  80. package/localization/zh-hans.xlf +72 -69
  81. package/package.json +4 -3
  82. package/src/lib/combobox.ts +455 -455
  83. package/src/lib/highlighter-fill.svg +5 -5
  84. package/src/snippets/Beispiel-Choice.html +57 -57
  85. package/src/snippets/Beispiel-Mark.html +13 -13
  86. package/src/snippets/Beispiel-Order.html +52 -52
  87. package/src/snippets/Beispiel-Text.html +20 -20
  88. package/src/snippets/choice.html +7 -7
  89. package/src/snippets/cloze.html +3 -3
  90. package/src/snippets/mark.html +3 -3
  91. package/src/snippets/order.html +7 -7
  92. package/src/snippets/pairing.html +9 -9
  93. package/src/snippets/speech.html +3 -3
  94. package/src/snippets/text.html +3 -3
  95. package/src/snippets/wordsearch.html +3 -3
  96. package/src/widgets/webwriter-choice-item.ts +256 -253
  97. package/src/widgets/webwriter-choice.ts +352 -336
  98. package/src/widgets/webwriter-cloze-gap.ts +215 -215
  99. package/src/widgets/webwriter-cloze.ts +135 -135
  100. package/src/widgets/webwriter-mark.ts +431 -431
  101. package/src/widgets/webwriter-order-item.ts +440 -440
  102. package/src/widgets/webwriter-order.ts +326 -309
  103. package/src/widgets/webwriter-pairing-item.ts +160 -160
  104. package/src/widgets/webwriter-pairing.ts +192 -192
  105. package/src/widgets/webwriter-quiz.ts +281 -281
  106. package/src/widgets/webwriter-speech.ts +272 -272
  107. package/src/widgets/webwriter-task-explainer.ts +42 -42
  108. package/src/widgets/webwriter-task-hint.ts +22 -22
  109. package/src/widgets/webwriter-task-prompt.ts +23 -23
  110. package/src/widgets/webwriter-task.ts +554 -546
  111. package/src/widgets/webwriter-text.ts +176 -155
  112. package/tsconfig.json +6 -6
@@ -1,161 +1,161 @@
1
- import {html, css} from "lit"
2
- import {LitElementWw, option} from "@webwriter/lit"
3
- import {customElement, property} from "lit/decorators.js"
4
- import "@shoelace-style/shoelace/dist/themes/light.css"
5
-
6
- import LOCALIZE from "../../localization/generated"
7
- import {msg} from "@lit/localize"
8
-
9
- declare global {interface HTMLElementTagNameMap {
10
- "webwriter-pairing-item": WebwriterPairingItem;
11
- }}
12
-
13
- @customElement("webwriter-pairing-item")
14
- export class WebwriterPairingItem extends LitElementWw {
15
-
16
- localize = LOCALIZE
17
-
18
- tabIndex = -1
19
-
20
- static styles = css`
21
-
22
- :host {
23
- aspect-ratio: 1;
24
- min-width: 125px;
25
- max-width: 350px;
26
- min-height: 125px;
27
- max-height: 350px;
28
- position: relative;
29
- overflow: hidden;
30
- overflow-y: auto;
31
- scrollbar-width: thin;
32
- resize: both;
33
- border: 2px solid var(--sl-color-gray-500);
34
- border-radius: 5px;
35
- background: white;
36
- }
37
-
38
- slot {
39
- width: 100%;
40
- height: 100%;
41
- display: flex;
42
- box-sizing: border-box;
43
- position: relative;
44
- font-size: 0.8em;
45
- z-index: 1;
46
- }
47
-
48
- :host([droppreview]) slot {
49
- background: lightblue;
50
- }
51
-
52
- ::slotted(*) {
53
- height: 100%;
54
- width: 100%;
55
- box-sizing: border-box;
56
- }
57
-
58
- ::slotted(:not(:is(picture, audio, video, img, iframe))) {
59
- padding: 5px !important;
60
- }
61
-
62
- #handle {
63
- box-sizing: border-box;
64
- border-radius: 2px;
65
- position: absolute;
66
- left: 1px;
67
- bottom: 1px;
68
- width: 20px;
69
- height: 30px;
70
- display: inline-block;
71
- overflow: hidden;
72
- line-height: 5px;
73
- padding: 6px 4px;
74
- cursor: move;
75
- vertical-align: middle;
76
- font-size: 12px;
77
- font-family: sans-serif;
78
- letter-spacing: 2px;
79
- color: #cccccc;
80
- text-shadow: 1px 0 1px black;
81
- font-weight: 600;
82
- opacity: 0.95;
83
- z-index: 100;
84
- }
85
- #handle::after {
86
- content: '.. .. ..';
87
- }
88
-
89
- :host(:not([contenteditable=true]):not([contenteditable=""])) .author-only {
90
- display: none !important;
91
- }
92
-
93
- #click-overlay {
94
- position: absolute;
95
- top: 0;
96
- width: 100%;
97
- height: 100%;
98
- cursor: pointer;
99
- }
100
-
101
- #click-overlay:hover {
102
- background: var(--sl-color-primary-600);
103
- opacity: 10%;
104
- }
105
-
106
- :host(.ww-selected) #click-overlay {
107
- display: none;
108
- }
109
- `
110
-
111
- @property({attribute: true, reflect: true, converter: {toAttribute: (v: boolean) => v? "true": "false", fromAttribute: (attr: string) => attr === "true"}})
112
- accessor draggable = true
113
-
114
- @property({type: Boolean, attribute: true, reflect: true})
115
- accessor dropPreview = false
116
-
117
- connectedCallback(): void {
118
- super.connectedCallback()
119
- this.addEventListener("dragstart", e => {
120
- if(e.target !== this) {
121
- e.preventDefault()
122
- }
123
- // this.dropPreview = undefined
124
- e.dataTransfer.setData("text/html", this.outerHTML)
125
- e.dataTransfer.setData("text/plain", this.id)
126
- // setTimeout(() => this.baseEl.style.visibility = "hidden")
127
- e.stopPropagation()
128
- })
129
- this.addEventListener("drop", e => {
130
- e.stopPropagation()
131
- const id = e.dataTransfer.getData("text/plain")
132
- const el = document.querySelector(`webwriter-pairing-item#${id}`)
133
- if(!el) {
134
- const html = e.dataTransfer.getData("text/html")
135
- this.parentElement.insertAdjacentHTML("beforeend", html)
136
- }
137
- else if(el && !this.contains(el)) {
138
- this.parentElement.insertAdjacentElement("beforeend", el)
139
- }
140
- this.dispatchEvent(new CustomEvent("ww-pairwith", {bubbles: true, detail: {with: id}}))
141
- }, {passive: true})
142
- this.addEventListener("dragover", e => {
143
- this.dropPreview = true
144
- e.preventDefault()
145
- e.stopImmediatePropagation()
146
- })
147
- this.addEventListener("dragleave", () => this.dropPreview = false, {passive: true})
148
- document.addEventListener("dragend", (e) => {
149
- // (e.target as HTMLElement)?.remove()
150
- this.dropPreview = false
151
- }, {passive: true})
152
- }
153
-
154
- render() {
155
- return html`
156
- <slot></slot>
157
- <div class="author-only" id="handle" @click=${() => this.dispatchEvent(new FocusEvent("focus"))}></div>
158
-
159
- `
160
- }
1
+ import {html, css} from "lit"
2
+ import {LitElementWw, option} from "@webwriter/lit"
3
+ import {customElement, property} from "lit/decorators.js"
4
+ import "@shoelace-style/shoelace/dist/themes/light.css"
5
+
6
+ import LOCALIZE from "../../localization/generated"
7
+ import {msg} from "@lit/localize"
8
+
9
+ declare global {interface HTMLElementTagNameMap {
10
+ "webwriter-pairing-item": WebwriterPairingItem;
11
+ }}
12
+
13
+ @customElement("webwriter-pairing-item")
14
+ export class WebwriterPairingItem extends LitElementWw {
15
+
16
+ localize = LOCALIZE
17
+
18
+ tabIndex = -1
19
+
20
+ static styles = css`
21
+
22
+ :host {
23
+ aspect-ratio: 1;
24
+ min-width: 125px;
25
+ max-width: 350px;
26
+ min-height: 125px;
27
+ max-height: 350px;
28
+ position: relative;
29
+ overflow: hidden;
30
+ overflow-y: auto;
31
+ scrollbar-width: thin;
32
+ resize: both;
33
+ border: 2px solid var(--sl-color-gray-500);
34
+ border-radius: 5px;
35
+ background: white;
36
+ }
37
+
38
+ slot {
39
+ width: 100%;
40
+ height: 100%;
41
+ display: flex;
42
+ box-sizing: border-box;
43
+ position: relative;
44
+ font-size: 0.8em;
45
+ z-index: 1;
46
+ }
47
+
48
+ :host([droppreview]) slot {
49
+ background: lightblue;
50
+ }
51
+
52
+ ::slotted(*) {
53
+ height: 100%;
54
+ width: 100%;
55
+ box-sizing: border-box;
56
+ }
57
+
58
+ ::slotted(:not(:is(picture, audio, video, img, iframe))) {
59
+ padding: 5px !important;
60
+ }
61
+
62
+ #handle {
63
+ box-sizing: border-box;
64
+ border-radius: 2px;
65
+ position: absolute;
66
+ left: 1px;
67
+ bottom: 1px;
68
+ width: 20px;
69
+ height: 30px;
70
+ display: inline-block;
71
+ overflow: hidden;
72
+ line-height: 5px;
73
+ padding: 6px 4px;
74
+ cursor: move;
75
+ vertical-align: middle;
76
+ font-size: 12px;
77
+ font-family: sans-serif;
78
+ letter-spacing: 2px;
79
+ color: #cccccc;
80
+ text-shadow: 1px 0 1px black;
81
+ font-weight: 600;
82
+ opacity: 0.95;
83
+ z-index: 100;
84
+ }
85
+ #handle::after {
86
+ content: '.. .. ..';
87
+ }
88
+
89
+ :host(:not([contenteditable=true]):not([contenteditable=""])) .author-only {
90
+ display: none !important;
91
+ }
92
+
93
+ #click-overlay {
94
+ position: absolute;
95
+ top: 0;
96
+ width: 100%;
97
+ height: 100%;
98
+ cursor: pointer;
99
+ }
100
+
101
+ #click-overlay:hover {
102
+ background: var(--sl-color-primary-600);
103
+ opacity: 10%;
104
+ }
105
+
106
+ :host(.ww-selected) #click-overlay {
107
+ display: none;
108
+ }
109
+ `
110
+
111
+ @property({attribute: true, reflect: true, converter: {toAttribute: (v: boolean) => v? "true": "false", fromAttribute: (attr: string) => attr === "true"}})
112
+ accessor draggable = true
113
+
114
+ @property({type: Boolean, attribute: true, reflect: true})
115
+ accessor dropPreview = false
116
+
117
+ connectedCallback(): void {
118
+ super.connectedCallback()
119
+ this.addEventListener("dragstart", e => {
120
+ if(e.target !== this) {
121
+ e.preventDefault()
122
+ }
123
+ // this.dropPreview = undefined
124
+ e.dataTransfer.setData("text/html", this.outerHTML)
125
+ e.dataTransfer.setData("text/plain", this.id)
126
+ // setTimeout(() => this.baseEl.style.visibility = "hidden")
127
+ e.stopPropagation()
128
+ })
129
+ this.addEventListener("drop", e => {
130
+ e.stopPropagation()
131
+ const id = e.dataTransfer.getData("text/plain")
132
+ const el = document.querySelector(`webwriter-pairing-item#${id}`)
133
+ if(!el) {
134
+ const html = e.dataTransfer.getData("text/html")
135
+ this.parentElement.insertAdjacentHTML("beforeend", html)
136
+ }
137
+ else if(el && !this.contains(el)) {
138
+ this.parentElement.insertAdjacentElement("beforeend", el)
139
+ }
140
+ this.dispatchEvent(new CustomEvent("ww-pairwith", {bubbles: true, detail: {with: id}}))
141
+ }, {passive: true})
142
+ this.addEventListener("dragover", e => {
143
+ this.dropPreview = true
144
+ e.preventDefault()
145
+ e.stopImmediatePropagation()
146
+ })
147
+ this.addEventListener("dragleave", () => this.dropPreview = false, {passive: true})
148
+ document.addEventListener("dragend", (e) => {
149
+ // (e.target as HTMLElement)?.remove()
150
+ this.dropPreview = false
151
+ }, {passive: true})
152
+ }
153
+
154
+ render() {
155
+ return html`
156
+ <slot></slot>
157
+ <div class="author-only" id="handle" @click=${() => this.dispatchEvent(new FocusEvent("focus"))}></div>
158
+
159
+ `
160
+ }
161
161
  }