@windward/games 0.7.0 → 0.8.1

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 (28) hide show
  1. package/babel.config.js +1 -1
  2. package/components/content/blocks/crosswordPuzzle/CrosswordPuzzle.vue +10 -2
  3. package/components/content/blocks/dragDrop/BucketGame.vue +6 -1
  4. package/components/content/blocks/dragDrop/SortingGame.vue +4 -2
  5. package/components/content/blocks/flashcards/FlashcardSlides.vue +2 -2
  6. package/components/content/blocks/matchingGame/MatchingGame.vue +34 -10
  7. package/components/content/blocks/multipleChoice/MultipleChoice.vue +10 -2
  8. package/components/content/blocks/multipleChoice/QuestionDialog.vue +4 -7
  9. package/components/content/blocks/quizshowGame/QuizShow.vue +0 -7
  10. package/components/content/blocks/slideshow/SlideShow.vue +6 -1
  11. package/components/settings/BucketGameSettingsManager.vue +6 -30
  12. package/components/settings/CrosswordPuzzleSettingsManager.vue +6 -28
  13. package/components/settings/FlashCardSlidesManager.vue +12 -34
  14. package/components/settings/MatchingGameManager.vue +30 -50
  15. package/components/settings/MultipleChoiceSettingsManager.vue +6 -30
  16. package/components/settings/QuizShowSettingsManager.vue +12 -62
  17. package/components/settings/SevenStrikesSettingsManager.vue +12 -47
  18. package/components/settings/SlideShowManager.vue +20 -47
  19. package/components/settings/SortingGameSettingsManager.vue +8 -44
  20. package/components/settings/WordJumbleSettingsManager.vue +10 -46
  21. package/i18n/en-US/shared/content_blocks.ts +1 -1
  22. package/i18n/en-US/shared/settings.ts +3 -0
  23. package/i18n/es-ES/shared/settings.ts +3 -0
  24. package/i18n/sv-SE/shared/settings.ts +4 -1
  25. package/package.json +4 -4
  26. package/test/mocks.js +10 -2
  27. package/test/settings/BucketGameManager.spec.js +0 -1
  28. package/test/settings/FlashCardSlidesManager.spec.js +2 -2
@@ -3,11 +3,12 @@
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
5
  ref="title"
6
+ id="block-settings-title"
6
7
  v-model="block.metadata.config.title"
7
- :rules="validation.shortInputRules"
8
+ :rules="$Validation.getRule('block.title')"
9
+ :counter="$Validation.getLimit('block.title')"
8
10
  :autofocus="true"
9
11
  outlined
10
- :counter="50"
11
12
  :label="
12
13
  $t(
13
14
  'windward.games.components.settings.matching_game.form.title'
@@ -16,11 +17,12 @@
16
17
  :disabled="render"
17
18
  ></v-text-field>
18
19
  <v-textarea
20
+ id="block-settings-instructions"
19
21
  v-model="block.metadata.config.instructions"
20
- :rules="validation.instructionRule"
22
+ :rules="$Validation.getRule('block.instructions')"
23
+ :counter="$Validation.getLimit('block.instructions')"
21
24
  outlined
22
25
  auto-grow
23
- :counter="255"
24
26
  :label="
25
27
  $t(
26
28
  'windward.games.components.settings.matching_game.form.instructions'
@@ -68,8 +70,8 @@
68
70
  block.metadata.config.answerObjects[index]
69
71
  .display
70
72
  "
71
- :counter="50"
72
- :rules="validation.shortInputRules"
73
+ :rules="$Validation.getRule('shortInput')"
74
+ :counter="$Validation.getLimit('shortInput')"
73
75
  outlined
74
76
  :disabled="render"
75
77
  ></v-text-field>
@@ -175,8 +177,14 @@
175
177
  index
176
178
  ][indexPrompt].prompt
177
179
  "
178
- :counter="200"
179
- :rules="validation.promptRule"
180
+ :rules="
181
+ $Validation.getRule('longInput')
182
+ "
183
+ :counter="
184
+ $Validation.getLimit(
185
+ 'longInput'
186
+ )
187
+ "
180
188
  :label="
181
189
  $t(
182
190
  'windward.games.components.settings.matching_game.form.prompt_body'
@@ -211,7 +219,7 @@
211
219
  )
212
220
  "
213
221
  :placeholder="
214
- getAriaDescribedBy(
222
+ getAlt(
215
223
  block.metadata.config
216
224
  .prompts[index][
217
225
  indexPrompt
@@ -236,11 +244,11 @@
236
244
  outlined
237
245
  :label="
238
246
  $t(
239
- 'windward.games.components.content.blocks.matching_game.aria_described'
247
+ 'shared.file.attr.screenreader'
240
248
  )
241
249
  "
242
250
  :placeholder="
243
- getAlt(
251
+ getAriaDescribedBy(
244
252
  block.metadata.config
245
253
  .prompts[index][
246
254
  indexPrompt
@@ -259,11 +267,20 @@
259
267
  index
260
268
  ][indexPrompt].file
261
269
  "
270
+ outlined
262
271
  :assets.sync="block.assets"
263
272
  class="content-block-asset"
264
273
  mimes="image/png,image/jpeg"
265
274
  :disabled="render"
266
- ></ContentBlockAsset>
275
+ >
276
+ <template #title>
277
+ {{
278
+ $t(
279
+ 'windward.games.shared.settings.file_picker.image'
280
+ )
281
+ }}
282
+ </template>
283
+ </ContentBlockAsset>
267
284
  </v-container>
268
285
  <v-container class="pa-0">
269
286
  <v-text-field
@@ -278,6 +295,7 @@
278
295
  )
279
296
  "
280
297
  outlined
298
+ :disabled="render"
281
299
  ></v-text-field>
282
300
  </v-container>
283
301
  </v-container>
@@ -396,44 +414,6 @@ export default {
396
414
  return {
397
415
  valid: true,
398
416
  loading: false,
399
- validation: {
400
- shortInputRules: [
401
- (v) => {
402
- if (v && v.length >= 50) {
403
- return this.$t(
404
- 'windward.games.shared.settings.errors.input_limitations',
405
- [50]
406
- )
407
- } else {
408
- return true
409
- }
410
- },
411
- ],
412
- instructionRule: [
413
- (v) => {
414
- if (v && v.length >= 255) {
415
- return this.$t(
416
- 'windward.games.shared.settings.errors.input_limitations',
417
- [255]
418
- )
419
- } else {
420
- return true
421
- }
422
- },
423
- ],
424
- promptRule: [
425
- (v) => {
426
- if (v && v.length >= 200) {
427
- return this.$t(
428
- 'windward.games.shared.settings.errors.input_limitations',
429
- [50]
430
- )
431
- } else {
432
- return true
433
- }
434
- },
435
- ],
436
- },
437
417
  }
438
418
  },
439
419
  mounted() {},
@@ -2,11 +2,12 @@
2
2
  <div>
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
+ id="block-settings-title"
5
6
  v-model="block.metadata.config.title"
6
7
  outlined
7
8
  :autofocus="true"
8
- :rules="validation.titleRule"
9
- :counter="50"
9
+ :rules="$Validation.getRule('block.title')"
10
+ :counter="$Validation.getLimit('block.title')"
10
11
  :label="
11
12
  $t(
12
13
  'windward.games.components.settings.multiple_choice.title_placeholder'
@@ -15,11 +16,12 @@
15
16
  :disabled="render"
16
17
  ></v-text-field>
17
18
  <v-textarea
19
+ id="block-settings-instructions"
18
20
  v-model="block.metadata.config.instructions"
19
21
  outlined
20
- :rules="validation.instructionRule"
22
+ :rules="$Validation.getRule('block.instructions')"
23
+ :counter="$Validation.getLimit('block.instructions')"
21
24
  auto-grow
22
- :counter="255"
23
25
  :label="
24
26
  $t(
25
27
  'windward.games.components.settings.multiple_choice.instructions'
@@ -157,32 +159,6 @@ export default {
157
159
  isNotEditing: false,
158
160
  valid: true,
159
161
  loading: false,
160
- validation: {
161
- titleRule: [
162
- (v) => {
163
- if (v && v.length >= 50) {
164
- return this.$t(
165
- 'windward.games.shared.settings.errors.input_limitations',
166
- [50]
167
- )
168
- } else {
169
- return true
170
- }
171
- },
172
- ],
173
- instructionRule: [
174
- (v) => {
175
- if (v && v.length >= 255) {
176
- return this.$t(
177
- 'windward.games.shared.settings.errors.input_limitations',
178
- [50]
179
- )
180
- } else {
181
- return true
182
- }
183
- },
184
- ],
185
- },
186
162
  }
187
163
  },
188
164
  mounted() {
@@ -1,9 +1,10 @@
1
1
  <template>
2
2
  <div>
3
3
  <v-text-field
4
+ id="block-settings-title"
4
5
  v-model="block.metadata.config.title"
5
- :rules="validation.shortInputRules"
6
- :counter="50"
6
+ :rules="$Validation.getRule('block.title')"
7
+ :counter="$Validation.getLimit('block.title')"
7
8
  outlined
8
9
  :label="
9
10
  $t(
@@ -24,11 +25,12 @@
24
25
  ></v-checkbox>
25
26
  <br />
26
27
  <v-textarea
28
+ id="block-settings-instructions"
27
29
  outlined
28
30
  auto-grow
29
31
  v-model="block.metadata.config.instructions"
30
- :rules="validation.instructionRule"
31
- :counter="255"
32
+ :rules="$Validation.getRule('block.instructions')"
33
+ :counter="$Validation.getLimit('block.instructions')"
32
34
  :label="
33
35
  $t(
34
36
  'windward.games.components.settings.multiple_choice.instructions'
@@ -75,8 +77,12 @@
75
77
  index - 1
76
78
  ]
77
79
  "
78
- :rules="validation.shortInputRules"
79
- :counter="50"
80
+ :rules="
81
+ $Validation.getRule('shortInput')
82
+ "
83
+ :counter="
84
+ $Validation.getLimit('shortInput')
85
+ "
80
86
  :label="
81
87
  $tc(
82
88
  'windward.games.components.settings.quizshow_game.form.category',
@@ -241,62 +247,6 @@ export default {
241
247
  },
242
248
  data() {
243
249
  return {
244
- validation: {
245
- lengthRules: [
246
- (v) => !!v || this.$t('shared.forms.errors.required'),
247
- (v) =>
248
- (!!v && v.length >= 1) ||
249
- this.$t('shared.forms.errors.required'),
250
- (v) => {
251
- if (!!v && v <= 10) {
252
- return true
253
- } else {
254
- return this.$t('shared.forms.errors.number_lt', [
255
- 10,
256
- ])
257
- }
258
- },
259
- ],
260
- pointsRules: [
261
- (v) => !!v || this.$t('shared.forms.errors.required'),
262
- (v) =>
263
- (!!v && v.length >= 1) ||
264
- this.$t('shared.forms.errors.required'),
265
- (v) => {
266
- if (!!v && v <= 9999) {
267
- return true
268
- } else {
269
- return this.$t('shared.forms.errors.number_lt', [
270
- 9999,
271
- ])
272
- }
273
- },
274
- ],
275
- shortInputRules: [
276
- (v) => {
277
- if (v && v.length >= 50) {
278
- return this.$t(
279
- 'windward.games.shared.settings.errors.input_limitations',
280
- [50]
281
- )
282
- } else {
283
- return true
284
- }
285
- },
286
- ],
287
- instructionRule: [
288
- (v) => {
289
- if (v && v.length >= 255) {
290
- return this.$t(
291
- 'windward.games.shared.settings.errors.input_limitations',
292
- [255]
293
- )
294
- } else {
295
- return true
296
- }
297
- },
298
- ],
299
- },
300
250
  loading: false,
301
251
  cursor: 'changePointer',
302
252
  quizShowSettings: {
@@ -3,10 +3,11 @@
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
5
  ref="title"
6
+ id="block-settings-title"
6
7
  v-model="block.metadata.config.title"
7
- :rules="validation.shortInputRules"
8
+ :rules="$Validation.getRule('block.title')"
9
+ :counter="$Validation.getLimit('block.title')"
8
10
  outlined
9
- :counter="50"
10
11
  :autofocus="true"
11
12
  :label="
12
13
  $t(
@@ -16,9 +17,10 @@
16
17
  :disabled="render"
17
18
  ></v-text-field>
18
19
  <v-textarea
20
+ id="block-settings-instructions"
19
21
  v-model="block.metadata.config.instructions"
20
- :counter="255"
21
- :rules="validation.instructionRule"
22
+ :rules="$Validation.getRule('block.instructions')"
23
+ :counter="$Validation.getLimit('block.instructions')"
22
24
  outlined
23
25
  auto-grow
24
26
  :label="
@@ -65,8 +67,8 @@
65
67
  v-model="
66
68
  block.metadata.config.words[index].value
67
69
  "
68
- :rules="validation.shortInputRules"
69
- :counter="50"
70
+ :rules="$Validation.getRule('shortInput')"
71
+ :counter="$Validation.getLimit('shortInput')"
70
72
  outlined
71
73
  :autofocus="true"
72
74
  :disabled="render"
@@ -82,8 +84,8 @@
82
84
  v-model="
83
85
  block.metadata.config.words[index].hint
84
86
  "
85
- :rules="validation.clueRule"
86
- :counter="155"
87
+ :rules="$Validation.getRule('mediumInput')"
88
+ :counter="$Validation.getLimit('mediumInput')"
87
89
  outlined
88
90
  class="pt-4"
89
91
  :disabled="render"
@@ -169,7 +171,8 @@ export default {
169
171
  )
170
172
  }
171
173
  if (
172
- _.isEmpty(this.block.metadata.config.instructions) && this.block.id &&
174
+ _.isEmpty(this.block.metadata.config.instructions) &&
175
+ this.block.id &&
173
176
  !Uuid.test(this.block.id)
174
177
  ) {
175
178
  this.block.metadata.config.instructions = this.$t(
@@ -197,44 +200,6 @@ export default {
197
200
  return {
198
201
  valid: true,
199
202
  loading: false,
200
- validation: {
201
- shortInputRules: [
202
- (v) => {
203
- if (v && v.length >= 50) {
204
- return this.$t(
205
- 'windward.games.shared.settings.errors.input_limitations',
206
- [50]
207
- )
208
- } else {
209
- return true
210
- }
211
- },
212
- ],
213
- instructionRule: [
214
- (v) => {
215
- if (v && v.length >= 255) {
216
- return this.$t(
217
- 'windward.games.shared.settings.errors.input_limitations',
218
- [255]
219
- )
220
- } else {
221
- return true
222
- }
223
- },
224
- ],
225
- clueRule: [
226
- (v) => {
227
- if (v && v.length >= 155) {
228
- return this.$t(
229
- 'windward.games.shared.settings.errors.input_limitations',
230
- [155]
231
- )
232
- } else {
233
- return true
234
- }
235
- },
236
- ],
237
- },
238
203
  }
239
204
  },
240
205
  methods: {
@@ -2,10 +2,11 @@
2
2
  <div>
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
+ id="block-settings-title"
5
6
  v-model="block.metadata.config.title"
6
7
  outlined
7
- :rules="validation.shortInputRules"
8
- :counter="50"
8
+ :rules="$Validation.getRule('block.title')"
9
+ :counter="$Validation.getLimit('block.title')"
9
10
  :label="
10
11
  $t(
11
12
  'windward.games.components.settings.slideshow.form.title'
@@ -14,11 +15,12 @@
14
15
  :disabled="render"
15
16
  ></v-text-field>
16
17
  <v-textarea
18
+ id="block-settings-instructions"
17
19
  v-model="block.metadata.config.instructions"
18
20
  outlined
19
21
  auto-grow
20
- :rules="validation.instructionRule"
21
- :counter="255"
22
+ :rules="$Validation.getRule('block.instructions')"
23
+ :counter="$Validation.getLimit('block.instructions')"
22
24
  :label="
23
25
  $t(
24
26
  'windward.games.components.settings.slideshow.form.instructions'
@@ -56,8 +58,8 @@
56
58
  <v-container>
57
59
  <v-text-field
58
60
  v-model="block.metadata.config.slides[index].header"
59
- :rules="validation.shortInputRules"
60
- :counter="50"
61
+ :rules="$Validation.getRule('shortInput')"
62
+ :counter="$Validation.getLimit('shortInput')"
61
63
  :autofocus="true"
62
64
  outlined
63
65
  :label="
@@ -71,8 +73,8 @@
71
73
  v-model="
72
74
  block.metadata.config.slides[index].description
73
75
  "
74
- :rules="validation.clueRule"
75
- :counter="155"
76
+ :rules="$Validation.getRule('mediumInput')"
77
+ :counter="$Validation.getLimit('mediumInput')"
76
78
  outlined
77
79
  :label="
78
80
  $t(
@@ -90,7 +92,16 @@
90
92
  :assets.sync="block.assets"
91
93
  mimes="image/png,image/jpeg"
92
94
  :disabled="render"
93
- ></ContentBlockAsset>
95
+ outlined
96
+ >
97
+ <template #title>
98
+ {{
99
+ $t(
100
+ 'windward.games.shared.settings.file_picker.image'
101
+ )
102
+ }}
103
+ </template>
104
+ </ContentBlockAsset>
94
105
 
95
106
  <v-text-field
96
107
  v-if="
@@ -205,44 +216,6 @@ export default {
205
216
  valid: true,
206
217
  debounce: null,
207
218
  loading: false,
208
- validation: {
209
- shortInputRules: [
210
- (v) => {
211
- if (v && v.length >= 50) {
212
- return this.$t(
213
- 'windward.games.shared.settings.errors.input_limitations',
214
- [50]
215
- )
216
- } else {
217
- return true
218
- }
219
- },
220
- ],
221
- instructionRule: [
222
- (v) => {
223
- if (v && v.length >= 255) {
224
- return this.$t(
225
- 'windward.games.shared.settings.errors.input_limitations',
226
- [255]
227
- )
228
- } else {
229
- return true
230
- }
231
- },
232
- ],
233
- clueRule: [
234
- (v) => {
235
- if (v && v.length >= 155) {
236
- return this.$t(
237
- 'windward.games.shared.settings.errors.input_limitations',
238
- [155]
239
- )
240
- } else {
241
- return true
242
- }
243
- },
244
- ],
245
- },
246
219
  }
247
220
  },
248
221
  methods: {
@@ -3,11 +3,12 @@
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
5
  ref="title"
6
+ id="block-settings-title"
6
7
  v-model="block.metadata.config.title"
7
8
  outlined
8
9
  :autofocus="true"
9
- :rules="validation.shortInputRules"
10
- :counter="50"
10
+ :rules="$Validation.getRule('block.title')"
11
+ :counter="$Validation.getLimit('block.title')"
11
12
  :label="
12
13
  $t(
13
14
  'windward.games.components.settings.bucket_game.form.title'
@@ -16,11 +17,12 @@
16
17
  :disabled="render"
17
18
  ></v-text-field>
18
19
  <v-textarea
20
+ id="block-settings-instructions"
19
21
  v-model="block.metadata.config.instructions"
20
22
  outlined
21
23
  auto-grow
22
- :rules="validation.instructionRule"
23
- :counter="255"
24
+ :rules="$Validation.getRule('block.instructions')"
25
+ :counter="$Validation.getLimit('block.instructions')"
24
26
  :label="
25
27
  $t(
26
28
  'windward.games.components.settings.bucket_game.form.instructions'
@@ -63,8 +65,8 @@
63
65
  </p>
64
66
  <v-textarea
65
67
  v-model="block.metadata.config.answer[index].value"
66
- :rules="validation.sortableWordRule"
67
- :counter="155"
68
+ :rules="$Validation.getRule('mediumInput')"
69
+ :counter="$Validation.getLimit('mediumInput')"
68
70
  outlined
69
71
  :autofocus="true"
70
72
  :disabled="render"
@@ -193,44 +195,6 @@ export default {
193
195
  },
194
196
  ],
195
197
  cursor: null,
196
- validation: {
197
- shortInputRules: [
198
- (v) => {
199
- if (v && v.length >= 50) {
200
- return this.$t(
201
- 'windward.games.shared.settings.errors.input_limitations',
202
- [50]
203
- )
204
- } else {
205
- return true
206
- }
207
- },
208
- ],
209
- instructionRule: [
210
- (v) => {
211
- if (v && v.length >= 255) {
212
- return this.$t(
213
- 'windward.games.shared.settings.errors.input_limitations',
214
- [255]
215
- )
216
- } else {
217
- return true
218
- }
219
- },
220
- ],
221
- sortableWordRule: [
222
- (v) => {
223
- if (v && v.length >= 155) {
224
- return this.$t(
225
- 'windward.games.shared.settings.errors.input_limitations',
226
- [155]
227
- )
228
- } else {
229
- return true
230
- }
231
- },
232
- ],
233
- },
234
198
  }
235
199
  },
236
200
  methods: {