@windward/games 0.5.0 → 0.5.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.
@@ -8,7 +8,10 @@
8
8
  {{ block.metadata.config.instructions }}
9
9
  </p>
10
10
  <br />
11
- <v-carousel v-model="block.metadata.config.currentSlide">
11
+ <v-carousel
12
+ :value="block.metadata.config.currentSlide"
13
+ :hide-delimiters="hideDeliminators"
14
+ >
12
15
  <template #prev="{ on, attrs }">
13
16
  <v-btn
14
17
  variant="elevated"
@@ -39,7 +42,7 @@
39
42
  v-for="(card, index) in block.metadata.config.cards"
40
43
  :key="index"
41
44
  >
42
- <v-sheet height="100%" tile>
45
+ <v-sheet height="90%" tile>
43
46
  <Flashcard
44
47
  v-model="block.metadata.config.cards[index].side"
45
48
  :options="card"
@@ -59,6 +62,7 @@ import Flashcard from './Flashcard'
59
62
  import draggable from 'vuedraggable'
60
63
  import BaseContentBlock from '~/components/Content/Blocks/BaseContentBlock'
61
64
  import Crypto from '~/helpers/Crypto'
65
+
62
66
  export default {
63
67
  name: 'Flashcards',
64
68
  components: { Flashcard, draggable },
@@ -101,6 +105,35 @@ export default {
101
105
  }
102
106
  return 0
103
107
  },
108
+ hideDeliminators() {
109
+ const condition1 =
110
+ window.innerWidth <= 1483 ||
111
+ this.block.metadata.config.cards.length >= 13
112
+ const condition2 =
113
+ this.block.metadata.config.cards.length >= 12 &&
114
+ window.innerWidth <= 1692
115
+ const condition3 =
116
+ this.block.metadata.config.cards.length >= 11 &&
117
+ window.innerWidth <= 1634
118
+ const condition4 =
119
+ this.block.metadata.config.cards.length >= 10 &&
120
+ window.innerWidth <= 1571
121
+ const condition5 =
122
+ this.block.metadata.config.cards.length >= 9 &&
123
+ window.innerWidth <= 1518
124
+
125
+ if (
126
+ condition1 ||
127
+ condition2 ||
128
+ condition3 ||
129
+ condition4 ||
130
+ condition5
131
+ ) {
132
+ return true
133
+ } else {
134
+ return false
135
+ }
136
+ },
104
137
  },
105
138
  methods: {
106
139
  onActionPanelEdit() {
@@ -6,7 +6,7 @@
6
6
  <p class="mb-0">{{ block.metadata.config.instructions }}</p>
7
7
  </v-col>
8
8
  </v-row>
9
- <v-carousel height="auto">
9
+ <v-carousel height="auto" :hide-delimiters="hideDeliminators">
10
10
  <template #prev="{ on, attrs }">
11
11
  <v-btn
12
12
  variant="elevated"
@@ -285,6 +285,35 @@ export default {
285
285
  }
286
286
  return 0
287
287
  },
288
+ hideDeliminators() {
289
+ const condition1 =
290
+ window.innerWidth <= 1483 ||
291
+ this.block.metadata.config.questions.length >= 13
292
+ const condition2 =
293
+ this.block.metadata.config.questions.length >= 12 &&
294
+ window.innerWidth <= 1692
295
+ const condition3 =
296
+ this.block.metadata.config.questions.length >= 11 &&
297
+ window.innerWidth <= 1634
298
+ const condition4 =
299
+ this.block.metadata.config.questions.length >= 10 &&
300
+ window.innerWidth <= 1571
301
+ const condition5 =
302
+ this.block.metadata.config.questions.length >= 9 &&
303
+ window.innerWidth <= 1518
304
+
305
+ if (
306
+ condition1 ||
307
+ condition2 ||
308
+ condition3 ||
309
+ condition4 ||
310
+ condition5
311
+ ) {
312
+ return true
313
+ } else {
314
+ return false
315
+ }
316
+ },
288
317
  },
289
318
  watch: {
290
319
  render(newValue) {
@@ -16,6 +16,7 @@
16
16
  <template>
17
17
  <v-carousel
18
18
  v-model="block.metadata.config.currentWord"
19
+ :hide-delimiters="hideDeliminators"
19
20
  @change="onSlideChanged($event)"
20
21
  >
21
22
  <template #prev="{ on, attrs }">
@@ -203,6 +204,7 @@ import draggable from 'vuedraggable'
203
204
  import keyboard from './keyboard.vue'
204
205
  import CrudTable from '../../CrudTable'
205
206
  import BaseContentBlock from '~/components/Content/Blocks/BaseContentBlock'
207
+ import Crypto from '~/helpers/Crypto'
206
208
 
207
209
  export default {
208
210
  name: 'SevenStrikesGame',
@@ -265,6 +267,37 @@ export default {
265
267
  onStrike: 0,
266
268
  }
267
269
  },
270
+ computed: {
271
+ hideDeliminators() {
272
+ const condition1 =
273
+ window.innerWidth <= 1483 ||
274
+ this.block.metadata.config.words.length >= 13
275
+ const condition2 =
276
+ this.block.metadata.config.words.length >= 12 &&
277
+ window.innerWidth <= 1692
278
+ const condition3 =
279
+ this.block.metadata.config.words.length >= 11 &&
280
+ window.innerWidth <= 1634
281
+ const condition4 =
282
+ this.block.metadata.config.words.length >= 10 &&
283
+ window.innerWidth <= 1571
284
+ const condition5 =
285
+ this.block.metadata.config.words.length >= 9 &&
286
+ window.innerWidth <= 1518
287
+
288
+ if (
289
+ condition1 ||
290
+ condition2 ||
291
+ condition3 ||
292
+ condition4 ||
293
+ condition5
294
+ ) {
295
+ return true
296
+ } else {
297
+ return false
298
+ }
299
+ },
300
+ },
268
301
  watch: {
269
302
  render(newValue) {
270
303
  if (newValue) {
@@ -272,7 +305,6 @@ export default {
272
305
  }
273
306
  },
274
307
  },
275
- mounted() {},
276
308
  methods: {
277
309
  onChangeSlide(newIndex) {
278
310
  if (newIndex >= this.block.metadata.config.words.length) {
@@ -18,7 +18,10 @@
18
18
  </div>
19
19
  <div>
20
20
  <template v-if="block.metadata.config.slides.length !== 0">
21
- <v-carousel v-model="block.metadata.config.currentSlide">
21
+ <v-carousel
22
+ v-model="block.metadata.config.currentSlide"
23
+ :hide-delimiters="hideDeliminators"
24
+ >
22
25
  <template #prev="{ on, attrs }">
23
26
  <v-btn
24
27
  variant="elevated"
@@ -51,7 +54,10 @@
51
54
  :key="index"
52
55
  >
53
56
  <v-carousel-item>
54
- <div class="fill-height d-flex flex-column">
57
+ <v-sheet
58
+ height="85%"
59
+ class="fill-height d-flex flex-column"
60
+ >
55
61
  <div class="pa-0 ma-0">
56
62
  <h4 class="header-description">
57
63
  {{ slide['header'] }}
@@ -74,7 +80,7 @@
74
80
  contain
75
81
  />
76
82
  </div>
77
- </div>
83
+ </v-sheet>
78
84
  </v-carousel-item>
79
85
  </v-container>
80
86
  </v-carousel>
@@ -86,6 +92,7 @@
86
92
  <script>
87
93
  import _ from 'lodash'
88
94
  import BaseContentBlock from '~/components/Content/Blocks/BaseContentBlock'
95
+ import Crypto from '~/helpers/Crypto'
89
96
 
90
97
  export default {
91
98
  name: 'SlideShow',
@@ -120,6 +127,37 @@ export default {
120
127
  prev: {},
121
128
  }
122
129
  },
130
+ computed: {
131
+ hideDeliminators() {
132
+ const condition1 =
133
+ window.innerWidth <= 1483 ||
134
+ this.block.metadata.config.slides.length >= 13
135
+ const condition2 =
136
+ this.block.metadata.config.slides.length >= 12 &&
137
+ window.innerWidth <= 1692
138
+ const condition3 =
139
+ this.block.metadata.config.slides.length >= 11 &&
140
+ window.innerWidth <= 1634
141
+ const condition4 =
142
+ this.block.metadata.config.slides.length >= 10 &&
143
+ window.innerWidth <= 1571
144
+ const condition5 =
145
+ this.block.metadata.config.slides.length >= 9 &&
146
+ window.innerWidth <= 1518
147
+
148
+ if (
149
+ condition1 ||
150
+ condition2 ||
151
+ condition3 ||
152
+ condition4 ||
153
+ condition5
154
+ ) {
155
+ return true
156
+ } else {
157
+ return false
158
+ }
159
+ },
160
+ },
123
161
  watch: {
124
162
  render(newValue) {
125
163
  this.block.metadata.config.currentSlide = 0
@@ -16,6 +16,7 @@
16
16
  <template>
17
17
  <v-carousel
18
18
  v-model="block.metadata.config.currentWord"
19
+ :hide-delimiters="hideDeliminators"
19
20
  @change="onSlideChanged()"
20
21
  >
21
22
  <template #prev="{ on, attrs }">
@@ -220,6 +221,37 @@ export default {
220
221
  shuffledWord: '',
221
222
  }
222
223
  },
224
+ computed: {
225
+ hideDeliminators() {
226
+ const condition1 =
227
+ window.innerWidth <= 1483 ||
228
+ this.block.metadata.config.words.length >= 13
229
+ const condition2 =
230
+ this.block.metadata.config.words.length >= 12 &&
231
+ window.innerWidth <= 1692
232
+ const condition3 =
233
+ this.block.metadata.config.words.length >= 11 &&
234
+ window.innerWidth <= 1634
235
+ const condition4 =
236
+ this.block.metadata.config.words.length >= 10 &&
237
+ window.innerWidth <= 1571
238
+ const condition5 =
239
+ this.block.metadata.config.words.length >= 9 &&
240
+ window.innerWidth <= 1518
241
+
242
+ if (
243
+ condition1 ||
244
+ condition2 ||
245
+ condition3 ||
246
+ condition4 ||
247
+ condition5
248
+ ) {
249
+ return true
250
+ } else {
251
+ return false
252
+ }
253
+ },
254
+ },
223
255
  watch: {
224
256
  render(newValue) {
225
257
  this.updateJumble = Crypto.id()
@@ -201,22 +201,24 @@ export default {
201
201
  onBeforeSave() {
202
202
  this.block.metadata.config.words.forEach((element) => {
203
203
  // check against lowercase keyboard inputs
204
- element.value = element.value.toLowerCase()
205
- element.splitWord = element.value.split('')
206
- element.splitWord.forEach((letter) => {
207
- const letterIndex = element.splitWord.indexOf(letter)
208
- if (letter !== ' ') {
209
- element.splitWord[letterIndex] = {
210
- letter: letter,
211
- show: false,
204
+ if (element.value) {
205
+ element.value = element.value.toLowerCase()
206
+ element.splitWord = element.value.split('')
207
+ element.splitWord.forEach((letter) => {
208
+ const letterIndex = element.splitWord.indexOf(letter)
209
+ if (letter !== ' ') {
210
+ element.splitWord[letterIndex] = {
211
+ letter: letter,
212
+ show: false,
213
+ }
214
+ } else {
215
+ element.splitWord[letterIndex] = {
216
+ letter: letter,
217
+ show: true,
218
+ }
212
219
  }
213
- } else {
214
- element.splitWord[letterIndex] = {
215
- letter: letter,
216
- show: true,
217
- }
218
- }
219
- })
220
+ })
221
+ }
220
222
  })
221
223
  },
222
224
  onAddElement() {
@@ -202,25 +202,27 @@ export default {
202
202
  })
203
203
  },
204
204
  shuffle(str) {
205
- var a = str
206
- var newArr = []
207
- var neww = ''
208
- var text = a.replace(/[\r\n]/g, '').split(' ')
205
+ if (str) {
206
+ var a = str
207
+ var newArr = []
208
+ var neww = ''
209
+ var text = a.replace(/[\r\n]/g, '').split(' ')
209
210
 
210
- text.map(function (v) {
211
- v.split('').map(function () {
212
- var hash = Math.floor(Math.random() * v.length)
213
- neww += v[hash]
214
- v = v.replace(v.charAt(hash), '')
211
+ text.map(function (v) {
212
+ v.split('').map(function () {
213
+ var hash = Math.floor(Math.random() * v.length)
214
+ neww += v[hash]
215
+ v = v.replace(v.charAt(hash), '')
216
+ })
217
+ newArr.push(neww)
218
+ neww = ''
215
219
  })
216
- newArr.push(neww)
217
- neww = ''
218
- })
219
- var x = newArr.map((v) => v.split('').join(' ')).join('\n')
220
- str = x
221
- .split('')
222
- .map((v) => v.toUpperCase())
223
- .join('')
220
+ var x = newArr.map((v) => v.split('').join(' ')).join('\n')
221
+ str = x
222
+ .split('')
223
+ .map((v) => v.toUpperCase())
224
+ .join('')
225
+ }
224
226
  return str
225
227
  },
226
228
  onAddWord() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windward/games",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Windward UI Plugin Games",
5
5
  "main": "plugin.js",
6
6
  "scripts": {