@ecored-sena/base-kit 0.0.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 (67) hide show
  1. package/README.md +1 -0
  2. package/package.json +49 -0
  3. package/plugin/components/AccordionRED.vue +78 -0
  4. package/plugin/components/AcordionA.vue +78 -0
  5. package/plugin/components/Audio.vue +20 -0
  6. package/plugin/components/BannerHero.vue +104 -0
  7. package/plugin/components/CarouselCard.vue +70 -0
  8. package/plugin/components/CarouselRED.vue +65 -0
  9. package/plugin/components/Complementario.vue +81 -0
  10. package/plugin/components/Creditos.vue +101 -0
  11. package/plugin/components/Dialogo.vue +30 -0
  12. package/plugin/components/DialogoActividad.vue +274 -0
  13. package/plugin/components/DialogoBurbuja.vue +46 -0
  14. package/plugin/components/DialogoChat.vue +88 -0
  15. package/plugin/components/Footer.vue +42 -0
  16. package/plugin/components/GlobalComponents.js +39 -0
  17. package/plugin/components/Glosario.vue +100 -0
  18. package/plugin/components/ImagenInfografica.vue +100 -0
  19. package/plugin/components/ImagenInfograficaB.vue +68 -0
  20. package/plugin/components/Inicio.vue +128 -0
  21. package/plugin/components/LineaTiempoA.vue +30 -0
  22. package/plugin/components/LineaTiempoB.vue +36 -0
  23. package/plugin/components/LineaTiempoC.vue +95 -0
  24. package/plugin/components/LineaTiempoD.vue +51 -0
  25. package/plugin/components/LineaTiempoE.vue +25 -0
  26. package/plugin/components/ModalA.vue +22 -0
  27. package/plugin/components/PasosA.vue +59 -0
  28. package/plugin/components/PasosB.vue +90 -0
  29. package/plugin/components/Referencias.vue +45 -0
  30. package/plugin/components/ScrollHorizontal.vue +105 -0
  31. package/plugin/components/Separador.vue +12 -0
  32. package/plugin/components/SlyderA.vue +65 -0
  33. package/plugin/components/SlyderB.vue +48 -0
  34. package/plugin/components/SlyderC.vue +53 -0
  35. package/plugin/components/SlyderD.vue +50 -0
  36. package/plugin/components/SlyderE.vue +58 -0
  37. package/plugin/components/SlyderF.vue +141 -0
  38. package/plugin/components/TabsA.vue +44 -0
  39. package/plugin/components/TabsB.vue +40 -0
  40. package/plugin/components/TabsC.vue +39 -0
  41. package/plugin/components/TarjetaAudio.vue +65 -0
  42. package/plugin/components/TimeLineRED.vue +51 -0
  43. package/plugin/components/actividad/ActividadController.vue +34 -0
  44. package/plugin/components/actividad/actividadCompletar/ActividadCompletar.vue +283 -0
  45. package/plugin/components/actividad/actividadCompletar/ActividadCompletarFooter.vue +63 -0
  46. package/plugin/components/actividad/actividadCompletar/ActividadParrafo.vue +218 -0
  47. package/plugin/components/actividad/actividadCompletar/ActividadResultados.vue +215 -0
  48. package/plugin/components/actividad/actividadCuestionario/Actividad.vue +222 -0
  49. package/plugin/components/actividad/actividadCuestionario/ActividadBarraAvance.vue +116 -0
  50. package/plugin/components/actividad/actividadCuestionario/ActividadPregunta.vue +146 -0
  51. package/plugin/components/actividad/actividadCuestionario/ActividadResultados.vue +215 -0
  52. package/plugin/components/audioMixins.js +73 -0
  53. package/plugin/components/componentSlotMixins.js +87 -0
  54. package/plugin/components/dialogoMixins.js +28 -0
  55. package/plugin/components/globalMixins.js +11 -0
  56. package/plugin/components/plantilla/Accesibilidad.vue +101 -0
  57. package/plugin/components/plantilla/AsideMenu.vue +242 -0
  58. package/plugin/components/plantilla/BannerInterno.vue +66 -0
  59. package/plugin/components/plantilla/BannerPrincipal.vue +104 -0
  60. package/plugin/components/plantilla/BarraAvance.vue +379 -0
  61. package/plugin/components/plantilla/Curso.vue +12 -0
  62. package/plugin/components/plantilla/Footer.vue +42 -0
  63. package/plugin/components/plantilla/Header.vue +152 -0
  64. package/plugin/components/plantilla/ScrollHorizontal.vue +105 -0
  65. package/plugin/components/plantillaMixins.js +34 -0
  66. package/plugin/components/slyderMixins.js +18 -0
  67. package/plugin/plugin.js +49 -0
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <div class="tarjeta-avance">
3
+ <div class="row align-items-center">
4
+ <div class="d-none d-md-block col">
5
+ <div class="tarjeta-avance__barra-container ms-4">
6
+ <div class="tarjeta-avance__barra" :style="{ width: avanceWidth }" />
7
+ </div>
8
+ </div>
9
+ <div class="col col-md-auto text-center">
10
+ <span class="lh-1">
11
+ Pregunta {{ preguntaIndex + 1 }} de {{ preguntasCount }}
12
+ </span>
13
+ </div>
14
+ <div class="col-auto">
15
+ <div v-if="respuestasLength === preguntasCount" class="py-4"></div>
16
+ <button
17
+ v-else-if="respuestasLength === 9"
18
+ class="boton btn-lg boton--b py-3 px-4"
19
+ :class="{ 'boton--disabled': continuarDisabled }"
20
+ @click="$emit('continuar')"
21
+ >
22
+ <span>Verificar</span>
23
+ <i class="fas fa-arrow-right"></i>
24
+ </button>
25
+ <button
26
+ v-else
27
+ class="boton btn-lg boton--b py-3 px-4"
28
+ :class="{ 'boton--disabled': continuarDisabled }"
29
+ @click="$emit('continuar')"
30
+ >
31
+ <span>Continuar</span>
32
+ <i class="fas fa-arrow-right"></i>
33
+ </button>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </template>
38
+
39
+ <script>
40
+ export default {
41
+ name: 'ActividadBarraAvance',
42
+ props: {
43
+ preguntaIndex: {
44
+ type: Number,
45
+ required: true,
46
+ },
47
+ preguntasCount: {
48
+ type: Number,
49
+ required: true,
50
+ },
51
+ continuarDisabled: {
52
+ type: Boolean,
53
+ default: false,
54
+ },
55
+ respuestasLength: {
56
+ type: Number,
57
+ default: 0,
58
+ },
59
+ respuestas: {
60
+ type: Array,
61
+ required: true,
62
+ },
63
+ },
64
+ computed: {
65
+ avanceWidth() {
66
+ return `${((this.preguntaIndex + 1) / this.preguntasCount) * 100}%`
67
+ },
68
+ rtas() {
69
+ const respuestas = {
70
+ correctas: 0,
71
+ incorrectas: 0,
72
+ total: this.respuestas.length,
73
+ porcentaje: 0,
74
+ }
75
+ this.respuestas.forEach(r => {
76
+ if (r.esCorrecta) {
77
+ respuestas.correctas++
78
+ } else {
79
+ respuestas.incorrectas++
80
+ }
81
+ })
82
+ respuestas.porcentaje = (respuestas.correctas / respuestas.total) * 100
83
+ return respuestas
84
+ },
85
+ },
86
+ }
87
+ </script>
88
+
89
+ <style lang="sass" scoped>
90
+ .tarjeta-avance
91
+ background-color: #dce4ebff
92
+ border-bottom-right-radius: 10px
93
+ border-bottom-left-radius: 10px
94
+ overflow: hidden
95
+ @media (max-width: 560px)
96
+ padding-left: .85rem !important
97
+
98
+ .boton
99
+ border-radius: 0
100
+
101
+ .boton--disabled
102
+ opacity: 0.5
103
+ pointer-events: none
104
+
105
+ &__barra-container
106
+ background-color: #b4cce3ff
107
+ border-radius: 8px
108
+ height: 16px
109
+ overflow: hidden
110
+ .tarjeta-avance__barra
111
+ background-color: #2c70abff
112
+ height: 100%
113
+ border-radius: 8px
114
+ width: 0%
115
+ transition: width 0.5s
116
+ </style>
@@ -0,0 +1,146 @@
1
+ <template>
2
+ <div>
3
+ <h3 class="mb-4 pb-4">
4
+ <strong
5
+ >{{ numeroPregunta }}. <span v-html="pregunta.texto"></span
6
+ ></strong>
7
+ </h3>
8
+ <div class="row align-items-center">
9
+ <div class="d-none d-md-block col-5">
10
+ <img :src="pregunta.imagen" alt="" />
11
+ </div>
12
+ <div class="col">
13
+ <div
14
+ v-for="(respuesta, idx) in opcionesComputed"
15
+ :key="respuesta.id"
16
+ class="tarjeta tarjeta--azul tarjeta-respuesta p-4"
17
+ :class="{
18
+ 'mb-3': idx !== opcionesComputed.length - 1,
19
+ 'tarjeta-respuesta--correcta': respuesta.correcta,
20
+ 'tarjeta-respuesta--incorrecta': respuesta.incorrecta,
21
+ 'tarjeta-respuesta--disabled': respuesta.disabled,
22
+ }"
23
+ @click="onRespuestaSelected(respuesta)"
24
+ >
25
+ <div class="row align-items-center">
26
+ <div class="col-auto">
27
+ <div
28
+ class="tarjeta-respuesta__icon"
29
+ :class="[
30
+ respuestaSelected.id === respuesta.id
31
+ ? respuesta.esCorrecta
32
+ ? 'tarjeta-respuesta__icon--correcto'
33
+ : 'tarjeta-respuesta__icon--incorrecto'
34
+ : '',
35
+ ]"
36
+ />
37
+ </div>
38
+ <div class="col" v-html="respuesta.texto"></div>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ <template v-if="respuestaSelected.id">
44
+ <hr />
45
+ <div v-if="respuestaSelected.esCorrecta" class="pt-1">
46
+ <span class="text-success h3 ma-0">¡Correcto!</span>
47
+ {{ pregunta.mensaje_correcto }}
48
+ </div>
49
+ <div v-else class="pt-1">
50
+ <span class="text-danger h3 ma-0">¡Incorrecto!</span>
51
+ {{ pregunta.mensaje_incorrecto }}
52
+ </div>
53
+ </template>
54
+ </div>
55
+ </template>
56
+
57
+ <script>
58
+ export default {
59
+ name: 'ActividadPregunta',
60
+ props: {
61
+ pregunta: {
62
+ type: Object,
63
+ required: true,
64
+ },
65
+ numeroPregunta: {
66
+ type: Number,
67
+ required: true,
68
+ },
69
+ },
70
+ data: () => ({
71
+ respuestaSelected: {},
72
+ }),
73
+ computed: {
74
+ opcionesComputed() {
75
+ if (!this.pregunta.opciones.length) return []
76
+ const selectedId = this.respuestaSelected.id
77
+ return this.pregunta.opciones.map(opcion => ({
78
+ ...opcion,
79
+ correcta: selectedId === opcion.id && opcion.esCorrecta,
80
+ incorrecta: selectedId === opcion.id && !opcion.esCorrecta,
81
+ disabled: !!selectedId,
82
+ }))
83
+ },
84
+ },
85
+ watch: {
86
+ pregunta() {
87
+ this.respuestaSelected = {}
88
+ },
89
+ },
90
+ methods: {
91
+ onRespuestaSelected(respuesta) {
92
+ this.respuestaSelected = respuesta
93
+ this.$emit('respuestaSelected', respuesta.esCorrecta)
94
+ },
95
+ },
96
+ }
97
+ </script>
98
+
99
+ <style lang="sass" scoped>
100
+ img
101
+ width: auto
102
+ height: auto
103
+ display: block
104
+ margin: auto
105
+ .tarjeta--pregunta
106
+ background: #dce4eb
107
+ .tarjeta-respuesta
108
+ border: 2px solid transparent
109
+ cursor: pointer
110
+ transition: border-color 0.2s
111
+ &:hover
112
+ border-color: #556a82
113
+
114
+ .tarjeta-respuesta__icon:not(.tarjeta-respuesta__icon--correcto):not(.tarjeta-respuesta__icon--incorrecto)
115
+ background-image: url('~@/assets/actividad/vacio-hover.svg')
116
+
117
+ &--correcta
118
+ border-color: #61ca92ff
119
+ background-color: #ebfff0ff
120
+ &:hover
121
+ border-color: #61ca92ff
122
+
123
+ &--incorrecta
124
+ border-color: #ff6b6bff
125
+ background-color: #ffedecff
126
+ &:hover
127
+ border-color: #ff6b6bff
128
+
129
+ &--disabled
130
+ cursor: not-allowed
131
+ pointer-events: none
132
+
133
+ &__icon
134
+ width: 32px
135
+ height: 32px
136
+ position: relative
137
+ background-image: url('~@/assets/actividad/vacio.svg')
138
+ &:hover
139
+ background-image: url('~@/assets/actividad/vacio-hover.svg')
140
+
141
+ &--correcto
142
+ background-image: url('~@/assets/actividad/correcto.svg')
143
+
144
+ &--incorrecto
145
+ background-image: url('~@/assets/actividad/incorrecto.svg')
146
+ </style>
@@ -0,0 +1,215 @@
1
+ <template>
2
+ <div class="row align-items-center justify-content-around">
3
+ <div class="col-lg-5">
4
+ <img
5
+ v-if="aprobado"
6
+ src="@/assets/componentes/cuestionario-resultado.svg"
7
+ alt=""
8
+ class="mx-auto d-none d-lg-block"
9
+ />
10
+ <img
11
+ v-else
12
+ src="@/assets/componentes/cuestionario-resultado.svg"
13
+ alt=""
14
+ class="mx-auto d-none d-lg-block"
15
+ />
16
+ </div>
17
+ <div class="col-lg-4">
18
+ <div class="d-flex align-items-center flex-column">
19
+ <div class="circle-container mb-4">
20
+ <svg class="circle" viewBox="0 0 36 36">
21
+ <defs>
22
+ <linearGradient
23
+ id="progressGradient"
24
+ x1="0%"
25
+ y1="0%"
26
+ x2="100%"
27
+ y2="0%"
28
+ >
29
+ <stop offset="0%" stop-color="#00FF00" />
30
+ <stop offset="50%" stop-color="#FFFF00" />
31
+ <stop offset="100%" stop-color="#FF0000" />
32
+ </linearGradient>
33
+ </defs>
34
+ <path
35
+ class="circle-bg"
36
+ d="M18 2.0845
37
+ a 15.9155 15.9155 0 0 1 0 31.831
38
+ a 15.9155 15.9155 0 0 1 0 -31.831"
39
+ />
40
+ <path
41
+ class="circle-progress"
42
+ :stroke-dasharray="`${currentPercentage}, 100`"
43
+ d="M18 2.0845
44
+ a 15.9155 15.9155 0 0 1 0 31.831
45
+ a 15.9155 15.9155 0 0 1 0 -31.831"
46
+ />
47
+ </svg>
48
+ <div class="percentage-text">
49
+ {{ Math.round(porcentajeAprobadas) }}%
50
+ </div>
51
+ </div>
52
+
53
+ <template v-if="aprobado">
54
+ <h3>{{ tituloAprobado }}</h3>
55
+ <p class="mb-0 text-center">
56
+ {{ mensajeAprobado }}
57
+ </p>
58
+ </template>
59
+ <template v-else>
60
+ <h3>{{ tituloReprobado }}</h3>
61
+ <p class="mb-0 text-center">
62
+ {{ mensajeReprobado }}
63
+ </p>
64
+ </template>
65
+ <hr class="w-100" />
66
+ <p class="mb-0">Aciertos: {{ rtas.correctas }} / {{ rtas.total }}</p>
67
+ <button
68
+ v-if="totalPreguntasBase >= preguntasCount"
69
+ class="boton btn-lg boton--b py-3 px-5 mt-3"
70
+ @click="$emit('reiniciar')"
71
+ >
72
+ <span>Volver a intentarlo</span>
73
+ </button>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ </template>
78
+
79
+ <script>
80
+ export default {
81
+ name: 'ActividadResultados',
82
+ props: {
83
+ respuestas: {
84
+ type: Array,
85
+ required: true,
86
+ },
87
+ mensajeAprobado: {
88
+ type: String,
89
+ default: '¡Excelente! Ha superado la actividad.',
90
+ },
91
+ mensajeReprobado: {
92
+ type: String,
93
+ default:
94
+ 'Le recomendamos volver a revisar el componente formativo e intentar nuevamente la actividad didáctica.',
95
+ },
96
+ tituloAprobado: {
97
+ type: String,
98
+ default: '¡BUEN TRABAJO!',
99
+ },
100
+ tituloReprobado: {
101
+ type: String,
102
+ default: 'VUELVE A INTENTARLO',
103
+ },
104
+ porcentajeAprobadas: {
105
+ type: Number,
106
+ required: true,
107
+ },
108
+ totalPreguntasBase: {
109
+ type: Number,
110
+ required: true,
111
+ },
112
+ preguntasCount: {
113
+ type: Number,
114
+ required: true,
115
+ },
116
+ },
117
+ data() {
118
+ return {
119
+ currentPercentage: 0,
120
+ }
121
+ },
122
+ computed: {
123
+ rtas() {
124
+ const respuestas = {
125
+ correctas: 0,
126
+ incorrectas: 0,
127
+ total: this.respuestas.length,
128
+ porcentaje: 0,
129
+ }
130
+ this.respuestas.forEach(r => {
131
+ if (r.esCorrecta) {
132
+ respuestas.correctas++
133
+ } else {
134
+ respuestas.incorrectas++
135
+ }
136
+ })
137
+ respuestas.porcentaje = (respuestas.correctas / respuestas.total) * 100
138
+ return respuestas
139
+ },
140
+ aprobado() {
141
+ return this.rtas.porcentaje >= 70
142
+ },
143
+ },
144
+ mounted() {
145
+ this.animateProgress()
146
+ },
147
+ methods: {
148
+ animateProgress() {
149
+ const duration = 1500
150
+ const start = performance.now()
151
+
152
+ const animate = time => {
153
+ const timeFraction = (time - start) / duration
154
+ if (timeFraction > 1) {
155
+ this.currentPercentage = this.porcentajeAprobadas
156
+ } else {
157
+ this.currentPercentage = timeFraction * this.porcentajeAprobadas
158
+ requestAnimationFrame(animate)
159
+ }
160
+ }
161
+
162
+ requestAnimationFrame(animate)
163
+ },
164
+ },
165
+ }
166
+ </script>
167
+
168
+ <style lang="sass" scoped>
169
+
170
+
171
+ .resultados
172
+ &__icono
173
+ width: 150px
174
+ height: 150px
175
+ background-size: cover
176
+ background-repeat: no-repeat
177
+ &--correcto
178
+ background-image: url('~@/assets/actividad/correcto.svg')
179
+ &--incorrecto
180
+ background-image: url('~@/assets/actividad/incorrecto.svg')
181
+ @media (max-width: 560px)
182
+ width: 80px
183
+ height: 80px
184
+
185
+ .circle-container
186
+ width: 150px
187
+ height: 150px
188
+ position: relative
189
+ display: flex
190
+ justify-content: center
191
+ align-items: center
192
+
193
+ .circle
194
+ transform: rotate(0deg)
195
+ width: 100%
196
+ height: 100%
197
+
198
+ .circle-bg
199
+ fill: none
200
+ stroke: #eee
201
+ stroke-width: 3.8
202
+
203
+ .circle-progress
204
+ fill: none
205
+ stroke: url(#progressGradient)
206
+ stroke-width: 3.8
207
+ stroke-linecap: round
208
+ transition: stroke-dasharray 0.1s
209
+
210
+ .percentage-text
211
+ position: absolute
212
+ font-size: 1.5rem
213
+ font-weight: bold
214
+ color: #666
215
+ </style>
@@ -0,0 +1,73 @@
1
+ export default {
2
+ props: {
3
+ audio: {
4
+ type: String,
5
+ default: '',
6
+ },
7
+ },
8
+ data: () => ({
9
+ audioElement: null,
10
+ audioCanPlay: false,
11
+ audioDuration: 0,
12
+ currentTime: 0,
13
+ state: 'pause',
14
+ }),
15
+ computed: {
16
+ currentTimeDisplay() {
17
+ return this.getTimeFormated(this.currentTime)
18
+ },
19
+ audioDurationDisplay() {
20
+ return this.getTimeFormated(this.audioDuration)
21
+ },
22
+ },
23
+ mounted() {
24
+ this.audioElement = this.createAudioElement()
25
+ this.audioElement.oncanplay = () => {
26
+ this.audioCanPlay = true
27
+ }
28
+ this.audioElement.onloadedmetadata = ({ target }) => {
29
+ this.audioCanPlay = true
30
+ this.audioDuration = target.duration
31
+ }
32
+ this.audioElement.onended = () => {
33
+ this.audioElement.currentTime = 0
34
+ this.state = 'pause'
35
+ }
36
+ this.audioElement.ontimeupdate = ({ target }) => {
37
+ this.currentTime = target.currentTime
38
+ }
39
+ },
40
+ beforeDestroy() {
41
+ this.audioElement.remove()
42
+ },
43
+ methods: {
44
+ getTimeFormated(time) {
45
+ const totalSeconds = Math.floor(time)
46
+ let minutes = Math.floor(totalSeconds / 60)
47
+ let seconds = totalSeconds % 60
48
+ minutes = minutes < 10 ? `0${minutes}` : minutes
49
+ seconds = seconds < 10 ? `0${seconds}` : seconds
50
+ return `${minutes}:${seconds}`
51
+ },
52
+ createAudioElement() {
53
+ const audioElement = document.createElement('audio')
54
+ audioElement.setAttribute('preload', 'metadata')
55
+ audioElement.setAttribute('src', this.audio)
56
+ document.body.appendChild(audioElement)
57
+ return audioElement
58
+ },
59
+ play() {
60
+ this.state = 'play'
61
+ this.audioElement.play()
62
+ },
63
+ pause() {
64
+ this.state = 'pause'
65
+ this.audioElement.pause()
66
+ },
67
+ stop() {
68
+ this.state = 'pause'
69
+ this.audioElement.pause()
70
+ this.audioElement.currentTime = 0
71
+ },
72
+ },
73
+ }
@@ -0,0 +1,87 @@
1
+ export default {
2
+ data: () => ({
3
+ mainId: Math.floor(Math.random() * 10 ** 10),
4
+ selected: 0,
5
+ elements: [],
6
+ stateStr: '',
7
+ rendered: false,
8
+ firstSelection: true,
9
+ }),
10
+ watch: {
11
+ menuState() {
12
+ this.domUpdated()
13
+ },
14
+ },
15
+ created() {
16
+ window.addEventListener('resize', this.domUpdated)
17
+ },
18
+ mounted() {
19
+ this.$nextTick(() => {
20
+ this.crearElementos()
21
+ })
22
+ },
23
+ computed: {
24
+ menuState() {
25
+ return this.$store.getters.isMenuOpen
26
+ },
27
+ navObj() {
28
+ if (!this.elements.length || !this.secuencial) return {}
29
+ const idsArr = this.elements.map(elm => elm.id)
30
+ const idxOfSelected = idsArr.indexOf(this.selected)
31
+ if (idxOfSelected < 0) return {}
32
+
33
+ const navObj = {}
34
+ if (idxOfSelected === 0) {
35
+ navObj.next = idsArr[idxOfSelected + 1]
36
+ } else if (idxOfSelected + 1 === idsArr.length) {
37
+ navObj.back = idsArr[idxOfSelected - 1]
38
+ } else {
39
+ navObj.next = idsArr[idxOfSelected + 1]
40
+ navObj.back = idsArr[idxOfSelected - 1]
41
+ }
42
+ return navObj
43
+ },
44
+ },
45
+ beforeDestroy() {
46
+ window.removeEventListener('resize', this.domUpdated)
47
+ },
48
+ updated() {
49
+ this.$nextTick(() => {
50
+ if (this.getStateStr() != this.stateStr) {
51
+ this.crearElementos()
52
+ }
53
+ })
54
+ },
55
+ methods: {
56
+ crearElementos() {
57
+ if (!this.$slots.default) return []
58
+ else if (!this.$slots.default.length) return []
59
+ this.domUpdated()
60
+ this.elements = this.$slots.default.map((elemento, index) => {
61
+ const attributes =
62
+ elemento.data && elemento.data.attrs ? elemento.data.attrs : []
63
+ return {
64
+ id: this.mainId + index + 1,
65
+ elm: elemento.elm,
66
+ ...attributes,
67
+ }
68
+ })
69
+ if (this.firstSelection) {
70
+ this.selected = this.selected > 0 ? this.selected : this.elements[0].id
71
+ }
72
+ this.stateStr = this.getStateStr()
73
+ },
74
+ getActiveHeight(id) {
75
+ return this.$refs[id][0].scrollHeight + 'px'
76
+ },
77
+ getStateStr() {
78
+ return this.$slots.default.map(elm => elm.elm.outerHTML).join('')
79
+ },
80
+ domUpdated() {
81
+ this.rendered = false
82
+ setTimeout(() => {
83
+ this.rendered = true
84
+ }, 100)
85
+ },
86
+ },
87
+ }
@@ -0,0 +1,28 @@
1
+ export default {
2
+ data: () => ({
3
+ uid: Math.floor(Math.random() * 10 ** 10),
4
+ }),
5
+ methods: {
6
+ dialogoMerge(dialogoObj, esActividad = false) {
7
+ if (!dialogoObj.dialogo) return []
8
+ return dialogoObj.dialogo.map((line, idx) => ({
9
+ ...line,
10
+ id: this.uid + idx + 1,
11
+ textoIng: esActividad ? this.splitPhrase(line.textoIng) : line.textoIng,
12
+ textoEsp: esActividad ? this.splitPhrase(line.textoEsp) : line.textoEsp,
13
+ personaje:
14
+ dialogoObj.personajes &&
15
+ dialogoObj.personajes.find(
16
+ personaje => personaje.nombre === line.personaje,
17
+ ),
18
+ }))
19
+ },
20
+ splitPhrase(phrase) {
21
+ return phrase
22
+ .replace(/^\s+|\s+$/g, '&nbsp;')
23
+ .replace('***', '___*___')
24
+ .split('___')
25
+ .filter(Boolean)
26
+ },
27
+ },
28
+ }
@@ -0,0 +1,11 @@
1
+ export default {
2
+ methods: {
3
+ obtenerLink(ruta) {
4
+ const route = window.location.href
5
+ const separator = route.includes('/index.html#') ? 'index.html#' : '#/'
6
+ const baseRoute = route.split(separator)[0]
7
+ const routeEnd = ruta.startsWith('/') ? ruta.substring(1) : ruta
8
+ return baseRoute + routeEnd
9
+ },
10
+ },
11
+ }