ep-lib-ts 1.0.43 → 1.0.45

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 (158) hide show
  1. package/dist/BgAudio-Dju9jJiu.js +4 -0
  2. package/dist/DisplayBox-HvviLWyp.js +4 -0
  3. package/dist/Ep360Image-CQJBPImD.js +241 -0
  4. package/dist/{Ep360Video-b_stvC2Z.js → Ep360Video-CL_7mOiQ.js} +84 -77
  5. package/dist/EpAlert-8x1egKQ1.js +4 -0
  6. package/dist/EpAudio-DLQ0xWz1.js +4 -0
  7. package/dist/EpAvatar-DlaagQT-.js +4 -0
  8. package/dist/EpBadge-hENKUkCt.js +4 -0
  9. package/dist/EpBarChart-Bw8qKwqp.js +4 -0
  10. package/dist/EpBranchingScenario-CtCO_8zu.js +160 -0
  11. package/dist/EpBtn-BH1hWlHT.js +4 -0
  12. package/dist/EpCard-CqhPrVAv.js +4 -0
  13. package/dist/EpCardLink-DlP0NsFx.js +4 -0
  14. package/dist/EpChip-Bi3nop6O.js +4 -0
  15. package/dist/EpCodeblock-DhkGfhDz.js +4 -0
  16. package/dist/EpConclusion-DYGJFM9I.js +4 -0
  17. package/dist/EpContentSlider-BxHaDAWo.js +4 -0
  18. package/dist/{EpDarkmode-Bechg1uo.js → EpDarkmode-ChgCnqlF.js} +1 -1
  19. package/dist/EpDescription-CHv8jeTs.js +4 -0
  20. package/dist/EpDivider-dB-VxNYj.js +4 -0
  21. package/dist/EpDraggable-hJJjJ6hz.js +1676 -0
  22. package/dist/EpEdu-CcePBFeF.js +4 -0
  23. package/dist/EpFlex-BOIofhJe.js +4 -0
  24. package/dist/EpFunnelChart-B0cp8JDh.js +4 -0
  25. package/dist/EpHeader-4TIVPsGN.js +4 -0
  26. package/dist/EpHover-B6dcDLJH.js +4 -0
  27. package/dist/EpHoverCard-BYLDcALZ.js +4 -0
  28. package/dist/EpIcon-eQLd8Bef.js +4 -0
  29. package/dist/EpIframe-DmNysxf-.js +4 -0
  30. package/dist/EpImg-oLjhJdIS.js +4 -0
  31. package/dist/EpImgCarousel-DXPylqN5.js +4 -0
  32. package/dist/{EpInput-CoSeoa1t.js → EpInput-B-bfsw5E.js} +29 -29
  33. package/dist/EpInstructions-DIAYW894.js +4 -0
  34. package/dist/EpIntroduction-DNNy0dG3.js +4 -0
  35. package/dist/EpLineChart-0D56Uh_r.js +4 -0
  36. package/dist/EpLink-DSTdUEpY.js +4 -0
  37. package/dist/EpLinkVersion-gKk7KyA_.js +4 -0
  38. package/dist/{EpList-DTN7D9wV.js → EpList-DeapPqmX.js} +1 -1
  39. package/dist/EpModal-D16kxfDo.js +4 -0
  40. package/dist/{EpNothing-ChLi44xn.js → EpNothing-BglmKV-f.js} +1 -1
  41. package/dist/EpObjective-HxaZ9wp9.js +4 -0
  42. package/dist/EpPieChart-DgshvJsj.js +4 -0
  43. package/dist/EpQuestion-Dukzq4EH.js +4 -0
  44. package/dist/EpQuote-CzHty5N8.js +4 -0
  45. package/dist/EpRadio-b-7_ookc.js +4 -0
  46. package/dist/EpRadioSummative-B2rKvUDx.js +4 -0
  47. package/dist/EpReading-B4cnESfa.js +4 -0
  48. package/dist/EpResource-Cm_WCcOE.js +4 -0
  49. package/dist/EpScope-D7uqngTc.js +4 -0
  50. package/dist/EpSection-D5dy1gIO.js +4 -0
  51. package/dist/EpSectionCols-Td__J3LQ.js +4 -0
  52. package/dist/EpSkeleton-Dt9pU2x3.js +4 -0
  53. package/dist/EpSoftware-ZrDbL3q8.js +4 -0
  54. package/dist/EpSpecificObjective-BLP9pKHT.js +4 -0
  55. package/dist/EpSpinner-Bz6bpXEH.js +4 -0
  56. package/dist/EpStackedList-C-qDZcDO.js +4 -0
  57. package/dist/EpSummativeTable-D0IxH0wd.js +4 -0
  58. package/dist/EpSvg-CFAjqJWI.js +4 -0
  59. package/dist/EpSvgShow-BMQFmzKO.js +54 -0
  60. package/dist/EpTable-CFfBZzZJ.js +4 -0
  61. package/dist/EpTerm-C81Atlu_.js +4 -0
  62. package/dist/EpText-DPADYfER.js +4 -0
  63. package/dist/EpTimeLine-BaJ78dV9.js +4 -0
  64. package/dist/EpVideo-m4Cga9WS.js +4 -0
  65. package/dist/EpVideoPanopto-DrHaE_yl.js +4 -0
  66. package/dist/EpWordDef-CZw-9z0W.js +4 -0
  67. package/dist/components/basics/EpImgCarousel.vue.d.ts +77 -0
  68. package/dist/components/educationals/EpBranchingScenario.vue.d.ts +1 -0
  69. package/dist/components/educationals/EpInstructions.vue.d.ts +1 -0
  70. package/dist/components/interactions/Ep360Image.vue.d.ts +1 -0
  71. package/dist/components/interactions/EpDraggable.vue.d.ts +26 -0
  72. package/dist/components/interactions/EpSvgShow.vue.d.ts +33 -1
  73. package/dist/components/medias/EpCarousel.vue.d.ts +5 -0
  74. package/dist/ep-lib-ts.js +30 -30
  75. package/dist/ep-lib-ts.umd.cjs +4600 -4766
  76. package/dist/{index-BFsz449L.js → index-CwfMdRn8.js} +3755 -3591
  77. package/dist/{index-D-GKNNDO.js → index-DTH65_9T.js} +1 -1
  78. package/dist/{prism-iP2cUnBs.js → prism-D45WTYqI.js} +1 -1
  79. package/dist/style.css +1 -1
  80. package/dist/three.module-CWLs6nMo.js +33752 -0
  81. package/dist/types/Draggable.d.ts +15 -0
  82. package/dist/types/Image.d.ts +5 -0
  83. package/package.json +4 -2
  84. package/src/components/basics/EpImg.vue +1 -1
  85. package/src/components/basics/EpImgCarousel.vue +145 -0
  86. package/src/components/basics/EpText.vue +22 -18
  87. package/src/components/educationals/EpBranchingScenario.vue +15 -6
  88. package/src/components/educationals/EpConclusion.vue +1 -1
  89. package/src/components/educationals/EpDescription.vue +1 -1
  90. package/src/components/educationals/EpInstructions.vue +3 -2
  91. package/src/components/educationals/EpIntroduction.vue +1 -1
  92. package/src/components/educationals/EpReading.vue +3 -3
  93. package/src/components/interactions/Ep360Image.vue +32 -11
  94. package/src/components/interactions/Ep360Video.vue +15 -3
  95. package/src/components/interactions/EpDraggable.vue +192 -0
  96. package/src/components/interactions/EpSvgShow.vue +91 -38
  97. package/src/components/medias/EpCarousel.vue +74 -11
  98. package/src/components/tools/TimelineItem.vue +1 -1
  99. package/dist/BgAudio-BxmV-0cC.js +0 -4
  100. package/dist/DisplayBox-CUpEsLPU.js +0 -4
  101. package/dist/Ep360Image-Dmwx7NrY.js +0 -228
  102. package/dist/EpAlert-DZRwC-hR.js +0 -4
  103. package/dist/EpAudio-DWUaCLxZ.js +0 -4
  104. package/dist/EpAvatar-CB_8dpH1.js +0 -4
  105. package/dist/EpBadge-D2rYlVX2.js +0 -4
  106. package/dist/EpBarChart-20DIx08w.js +0 -4
  107. package/dist/EpBranchingScenario-CMBEwqVe.js +0 -151
  108. package/dist/EpBtn-D4Sib9BE.js +0 -4
  109. package/dist/EpCard-DJQezxQs.js +0 -4
  110. package/dist/EpCardLink-CZ10BP3M.js +0 -4
  111. package/dist/EpChip-BrlNEof-.js +0 -4
  112. package/dist/EpCodeblock-C-DQR2do.js +0 -4
  113. package/dist/EpConclusion-Cd2gP1Wh.js +0 -4
  114. package/dist/EpContentSlider-zQ7TcQlI.js +0 -4
  115. package/dist/EpDescription-Tbo3BFV2.js +0 -4
  116. package/dist/EpDivider-DVkzWELv.js +0 -4
  117. package/dist/EpEdu-B7If0gdy.js +0 -4
  118. package/dist/EpFlex-e5sNF2bY.js +0 -4
  119. package/dist/EpFunnelChart-DVJ_6KdY.js +0 -4
  120. package/dist/EpHeader-DNGWRkmf.js +0 -4
  121. package/dist/EpHover-_jWsMPY8.js +0 -4
  122. package/dist/EpHoverCard-C-BojFhi.js +0 -4
  123. package/dist/EpIcon-8MS-eLaB.js +0 -4
  124. package/dist/EpIframe-ClKZ7eIe.js +0 -4
  125. package/dist/EpImg-ZxP-DCOC.js +0 -4
  126. package/dist/EpInstructions-0UvWFAAP.js +0 -4
  127. package/dist/EpIntroduction-kwTAl-2S.js +0 -4
  128. package/dist/EpLineChart-DrqtLuL_.js +0 -4
  129. package/dist/EpLink-Be86I9U6.js +0 -4
  130. package/dist/EpLinkVersion-B4pxWTOZ.js +0 -4
  131. package/dist/EpModal-rL51M47q.js +0 -4
  132. package/dist/EpObjective-CDmtLCil.js +0 -4
  133. package/dist/EpPieChart--F20jSnB.js +0 -4
  134. package/dist/EpQuestion-B3bl3ED0.js +0 -4
  135. package/dist/EpQuote-WsTNUXP3.js +0 -4
  136. package/dist/EpRadio-5wRevOhg.js +0 -4
  137. package/dist/EpRadioSummative-Bhuk0G-D.js +0 -4
  138. package/dist/EpReading-DqNY4agb.js +0 -4
  139. package/dist/EpResource-CKx-Sm7H.js +0 -4
  140. package/dist/EpScope-CAGu6ain.js +0 -4
  141. package/dist/EpSection-Cs8w0x7y.js +0 -4
  142. package/dist/EpSectionCols-nBUK8VK3.js +0 -4
  143. package/dist/EpSkeleton-DBJIz_Yb.js +0 -4
  144. package/dist/EpSoftware-l7_8diQ_.js +0 -4
  145. package/dist/EpSpecificObjective-D2Sz35-I.js +0 -4
  146. package/dist/EpSpinner-BnfTBKN1.js +0 -4
  147. package/dist/EpStackedList-CtkpLHrV.js +0 -4
  148. package/dist/EpSummativeTable-CgQiZKos.js +0 -4
  149. package/dist/EpSvg-DDlhssE7.js +0 -4
  150. package/dist/EpSvgShow-DNKVoqjv.js +0 -84
  151. package/dist/EpTable-DriGGo4l.js +0 -4
  152. package/dist/EpTerm-DNfBy49u.js +0 -4
  153. package/dist/EpText-CrfoaXl_.js +0 -4
  154. package/dist/EpTimeLine-CRwBWqNV.js +0 -4
  155. package/dist/EpVideo-DV8hETkp.js +0 -4
  156. package/dist/EpVideoPanopto-588sRcMP.js +0 -4
  157. package/dist/EpWordDef-BuZFiK1M.js +0 -4
  158. package/dist/three.module-laS36oD-.js +0 -48903
@@ -0,0 +1,192 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref, onMounted, onUnmounted } from 'vue';
3
+ import { VueDraggableNext as draggable } from 'vue-draggable-next';
4
+
5
+ import { Choice, Answer, Sockets } from '../../types/Draggable';
6
+
7
+ import { mdiCheckBold, mdiCloseThick } from "@mdi/js";
8
+ import EpIcon from '../basics/EpIcon.vue';
9
+
10
+
11
+
12
+
13
+
14
+ interface Props {
15
+ answers: Answer[],
16
+ src: string,
17
+ sockets: Sockets[]
18
+ }
19
+
20
+ const props = withDefaults(defineProps<Props>(), {});
21
+
22
+
23
+
24
+
25
+ // Manage the image and its size
26
+
27
+ const originalWidth = ref(0);
28
+ const originalHeight = ref(0);
29
+
30
+ const actualRect = ref({ width: 0, height: 0 });
31
+ const myImage = ref<HTMLImageElement | null>(null);
32
+
33
+
34
+
35
+ const updateSize = () => {
36
+
37
+ if (!myImage.value) return;
38
+
39
+ const rect = myImage.value.getBoundingClientRect();
40
+ actualRect.value = { width: rect.width, height: rect.height };
41
+
42
+ console.log('Image size updated. Width:', actualRect.value.width, 'Height:', actualRect.value.height);
43
+ };
44
+
45
+
46
+ onMounted(() => {
47
+ window.addEventListener('resize', updateSize);
48
+ });
49
+ onUnmounted(() => {
50
+ window.removeEventListener('resize', updateSize);
51
+ });
52
+
53
+
54
+
55
+ const handleImageLoad = (event: any) => {
56
+ originalWidth.value = event.target.naturalWidth;
57
+ originalHeight.value = event.target.naturalHeight;
58
+
59
+ console.log('Image loaded. Width:', originalWidth.value, 'Height:', originalHeight.value);
60
+
61
+ updateSize();
62
+ }
63
+
64
+
65
+ const xRatio = computed(() => {
66
+ if (actualRect.value.width == 0) return 1;
67
+ return actualRect.value.width / originalWidth.value;
68
+ });
69
+
70
+ const yRatio = computed(() => {
71
+ if (actualRect.value.height == 0) return 1;
72
+ return actualRect.value.height / originalHeight.value;
73
+ });
74
+
75
+
76
+
77
+
78
+
79
+
80
+ // Créer une copie réactive de props.answers
81
+ const availableAnswers = ref([...props.answers]);
82
+
83
+ const choices = ref<Choice[]>( props.sockets.map((s) => {
84
+ return {
85
+ choice: [],
86
+ expected: s.correctAnswer ,
87
+ allowPut: true
88
+ }
89
+ }));
90
+
91
+
92
+
93
+
94
+ // Manage drag and drop
95
+ const onAdd = (event: any, index: number) => {
96
+ console.log(event.clone);
97
+
98
+ // Retirer l'élément de la liste des réponses disponibles
99
+ availableAnswers.value = availableAnswers.value.filter(item => item.name !== event.clone.name);
100
+ choices.value[index].allowPut = false;
101
+ }
102
+
103
+ const onRemove = (event: any, index: number) => {
104
+ console.log(event.clone);
105
+
106
+ choices.value[index].choice = [];
107
+ choices.value[index].allowPut = true;
108
+ }
109
+
110
+
111
+
112
+
113
+ // Manage verification buttons
114
+ const validating = ref(false);
115
+
116
+ const validate = () => {
117
+ validating.value = true;
118
+ choices.value.forEach((choice) => {
119
+ choice.allowPut = false;
120
+ });
121
+ }
122
+
123
+ const retry = () => {
124
+ validating.value = false;
125
+ availableAnswers.value = [...props.answers];
126
+ choices.value.forEach((choice) => {
127
+ choice.choice = [];
128
+ choice.allowPut = true;
129
+ });
130
+ }
131
+
132
+
133
+ </script>
134
+
135
+ <template>
136
+
137
+ <div class="flex flex-col">
138
+ <div class="grid grid-cols-3 gap-3 w-full my-8">
139
+
140
+ <!-- Draggable answers block -->
141
+ <div class="col-span-1 m-6">
142
+ <draggable
143
+ class="dragArea bg-gray-700 rounded-md p-4 min-h-5 list-group w-full"
144
+ v-model="availableAnswers"
145
+ :group="{ name: 'answers', pull: !validating, put: !validating }"
146
+ >
147
+ <div
148
+ class="list-group-item bg-gray-300 dark:bg-gray-800 m-1 p-3 rounded-md text-center flex justify-center items-center"
149
+ v-for="element in availableAnswers"
150
+ :key="element.name"
151
+ >
152
+ <img class="cursor-grab active:cursor-grabbing max-w-32 rounded" v-if="element.isImg" :src="element.src" alt="img" />
153
+ <p class="cursor-grab active:cursor-grabbing" v-else>{{ element.name }}</p>
154
+ </div>
155
+ </draggable>
156
+ </div>
157
+
158
+
159
+ <!-- Drop area block -->
160
+ <div class="col-span-2 relative">
161
+ <img @load="handleImageLoad" ref="myImage" :src="props.src" alt="img" class="w-full h-full select-none" />
162
+ <draggable
163
+ class="dropArea absolute bg-gray-300 dark:bg-gray-800 p-4 rounded-md min-w-14 max-w-32"
164
+ v-for="(socket, index) in props.sockets"
165
+ :key="index"
166
+ v-model="choices[index].choice"
167
+ :group="{ put: choices[index].allowPut }"
168
+ :style="{ left: (socket.xPos * xRatio) + 'px', top: (socket.yPos * yRatio) + 'px' }"
169
+ @add="onAdd($event, index)"
170
+ @remove="onRemove($event, index)"
171
+ >
172
+ <img class="cursor-grab active:cursor-grabbing rounded" v-if="choices[index].choice[0] && choices[index].choice[0].isImg" :src="choices[index].choice[0].src" alt="img" />
173
+ <p class="cursor-grab active:cursor-grabbing" v-else-if="choices[index].choice[0]">{{ choices[index].choice[0].name }}</p>
174
+ <span v-if="validating && choices[index].choice[0]?.name !== choices[index].expected" class="absolute -top-5 -right-5 bg-red-500 text-white px-2 py-1 rounded-md">
175
+ <EpIcon :iconPath="mdiCloseThick" size="18"></EpIcon>
176
+ </span>
177
+ <span v-if="validating && choices[index].choice[0]?.name === choices[index].expected" class="absolute -top-5 -right-5 bg-green-500 text-white px-2 py-1 rounded-md">
178
+ <EpIcon :iconPath="mdiCheckBold" size="18"></EpIcon>
179
+ </span>
180
+ </draggable>
181
+ </div>
182
+ </div>
183
+
184
+ <!-- Verification buttons -->
185
+ <div class="flex justify-center gap-4 mt-8">
186
+ <button class="bg-blue-500 text-white px-3 py-2 rounded-md text-center" @click="validate">Valider</button>
187
+ <button class="bg-blue-500 text-white px-3 py-2 rounded-md text-center" @click="retry">Recommencer</button>
188
+ </div>
189
+
190
+ </div>
191
+
192
+ </template>
@@ -1,44 +1,97 @@
1
1
  <script setup lang="ts">
2
+ import { onMounted, ref, computed, nextTick } from 'vue';
3
+ import { useRenderText } from '../../composables/useRenderText';
4
+
5
+
6
+
7
+ interface Props {
8
+ svg: string,
9
+ id: string,
10
+ animation?: "" | "translateX" | "scale",
11
+ multiple?: boolean
12
+ }
13
+
14
+
15
+ const props = withDefaults(defineProps<Props>(), {
16
+ animation: "",
17
+ multiple: false
18
+ });
19
+
20
+ const svg = ref<string>("");
21
+
22
+ const animationType = computed(() => {
23
+ switch (props.animation) {
24
+ case "translateX":
25
+ return "animate-slide";
26
+ case "scale":
27
+ return "animate-zoom";
28
+ default:
29
+ return "animate-fade";
30
+ }
31
+ });
32
+
33
+
34
+
35
+
36
+
37
+ onMounted(async() => {
38
+ svg.value = useRenderText(props.svg);
39
+
40
+ await nextTick();
41
+
42
+ // manage the scenes
43
+ const scenes = document.getElementById(props.id)?.getElementsByClassName('scene');
44
+
45
+ if(scenes) {
46
+ Array.from(scenes).forEach((s) => {
47
+ if(!s.classList.contains('hidden')) {
48
+ s.classList.add('hidden');
49
+ }
50
+ });
51
+ }
52
+
53
+ // manage the buttons
54
+ const btns = document.getElementById(props.id)?.getElementsByClassName('btn');
55
+
56
+ if(btns) {
57
+ Array.from(btns).forEach((b) => {
58
+ b.addEventListener('click', (e) => {
59
+ const scene = b.getAttribute("id");
60
+ showScene(scene?? "");
61
+ });
62
+ });
63
+ }
64
+ });
65
+
66
+
67
+
68
+ const showScene = (scene: string) => {
69
+ console.log('event', scene);
70
+ if(svg.value) {
71
+ const scenes = document.getElementById(props.id)?.getElementsByClassName('scene');
72
+ if(scenes) {
73
+ Array.from(scenes).forEach((s) => {
74
+ if (s.classList.contains(`scene-${scene}`)) {
75
+ s.classList.remove('hidden', animationType.value);
76
+ s.classList.add(animationType.value);
77
+ } else {
78
+ if(!props.multiple && !s.classList.contains('hidden')) {
79
+ s.classList.add('hidden');
80
+ s.classList.remove(animationType.value);
81
+ }
82
+ }
83
+ });
84
+ }
85
+ }
86
+ }
87
+
88
+
2
89
 
3
90
  </script>
4
91
 
92
+
5
93
  <template>
6
- <svg width="400" height="400" xmlns="http://www.w3.org/2000/svg">
7
-
8
- <!-- Buttons -->
9
- <g class="btn-horse btn" onclick="showScene('horse')">
10
- <rect x="10" y="10" width="80" height="30" />
11
- <text x="20" y="30" font-size="14" fill="white">Horse</text>
12
- </g>
13
- <g class="btn-pig btn" onclick="showScene('pig')">
14
- <rect x="110" y="10" width="80" height="30" />
15
- <text x="130" y="30" font-size="14" fill="white">Pig</text>
16
- </g>
17
- <g class="btn-turkey btn" onclick="showScene('turkey')">
18
- <rect x="210" y="10" width="80" height="30" />
19
- <text x="220" y="30" font-size="14" fill="white">Turkey</text>
20
- </g>
21
- <g class="btn-rabbit btn" onclick="showScene('rabbit')">
22
- <rect x="310" y="10" width="80" height="30" />
23
- <text x="320" y="30" font-size="14" fill="white">Rabbit</text>
24
- </g>
25
-
26
- <!-- Scenes -->
27
- <g class="scene-horse scene" id="scene-horse" transform="translate(200, 250) scale(2)" >
28
- <path d="M22 6V9.5L20.5 10L18.96 7.54C18.83 7.33 18.5 7.42 18.5 7.67V11.25C18.5 12.23 18.11 13.11 17.5 13.78V21H15V15C14.92 15 14.84 15 14.75 15C14.54 15 14.33 14.97 14.13 14.94L9.69 14.2L8.57 16.21L9.53 21H7L6 16.25C5.97 15.95 6 15.65 6.16 15.39L7.18 13.58C6.2 13.03 5.53 12 5.5 10.81C5.46 10.96 5.44 11.18 5.47 11.5C5.5 11.94 5.61 12.59 5.54 13.31C5.5 14.03 5.17 14.77 4.75 15.26C4.32 15.75 3.85 16.09 3.35 16.35L2.65 15.65C2.84 15.18 3.03 14.76 3.07 14.37C3.13 14 3.06 13.7 2.95 13.43L2.42 12.3C2.21 11.79 1.95 11.05 2 10.18C2.03 9.33 2.5 8.22 3.39 7.61C4.29 7 5.26 6.92 6.05 7.08C6.55 7.18 7.06 7.42 7.5 7.76C7.87 7.59 8.3 7.5 8.75 7.5H14.5V7C14.5 4.79 16.29 3 18.5 3H22L21.11 4.34C21.65 4.7 22 5.31 22 6Z" />
29
- </g>
30
-
31
- <g class="scene-pig scene" id="scene-pig"transform="translate(200, 100) scale(2)">
32
- <path d="M19.83 7.5L17.56 5.23C17.63 4.81 17.74 4.42 17.88 4.08C17.96 3.9 18 3.71 18 3.5C18 2.67 17.33 2 16.5 2C14.86 2 13.41 2.79 12.5 4H7.5C4.46 4 2 6.46 2 9.5S4.5 21 4.5 21H10V19H12V21H17.5L19.18 15.41L22 14.47V7.5H19.83" />
33
- </g>
34
-
35
- <g class="scene-turkey scene" id="scene-turkey" transform="translate(200, 150) scale(2)">
36
- <path d="M10.5 19.44C9.75 19.8 8.9 20 8 20C4.69 20 2 17.31 2 14V9C2 5.69 4.69 3 8 3L10.5 7.58C8.1 8.81 6.5 11 6.5 13.5C6.5 16 8.11 18.2 10.5 19.44M16 18.94V20H17C17.55 20 18 20.45 18 21S17.55 22 17 22H14C13.45 22 13 21.55 13 21S13.45 20 14 20V18.94C10.61 18.56 8 16.27 8 13.5C8 10.46 11.13 8 15 8C15.19 8 15.37 8 15.56 8C14.84 6.63 14 5.23 14 4C14 2.9 14.9 2 16 2C18.21 2 20 3.79 20 6H18C18 6 22 9 22 13.5C22 16.27 19.39 18.56 16 18.94M16 4C16 4.55 16.45 5 17 5S18 4.55 18 4 17.55 3 17 3 16 3.45 16 4M17 12C17 10.9 16.11 10 15 10C12.79 10 11 11.79 11 14H15C16.11 14 17 13.11 17 12Z" />
37
- </g>
38
-
39
- <g class="scene-rabbit scene" id="scene-rabbit"transform="translate(200, 200) scale(2)">
40
- <path d="M18.05,21L15.32,16.26C15.32,14.53 14.25,13.42 12.95,13.42C12.05,13.42 11.27,13.92 10.87,14.66C11.2,14.47 11.59,14.37 12,14.37C13.3,14.37 14.36,15.43 14.36,16.73C14.36,18.04 13.31,19.11 12,19.11H15.3V21H6.79C6.55,21 6.3,20.91 6.12,20.72C5.75,20.35 5.75,19.75 6.12,19.38V19.38L6.62,18.88C6.28,18.73 6,18.5 5.72,18.26C5.5,18.76 5,19.11 4.42,19.11C3.64,19.11 3,18.47 3,17.68C3,16.9 3.64,16.26 4.42,16.26L4.89,16.34V14.37C4.89,11.75 7,9.63 9.63,9.63H9.65C11.77,9.64 13.42,10.47 13.42,9.16C13.42,8.23 13.62,7.86 13.96,7.34C13.23,7 12.4,6.79 11.53,6.79C11,6.79 10.58,6.37 10.58,5.84C10.58,5.41 10.86,5.05 11.25,4.93L10.58,4.89C10.06,4.89 9.63,4.47 9.63,3.95C9.63,3.42 10.06,3 10.58,3H11.53C13.63,3 15.47,4.15 16.46,5.85L16.74,5.84C17.45,5.84 18.11,6.07 18.65,6.45L19.1,6.83C21.27,8.78 21,10.1 21,10.11C21,11.39 19.94,12.44 18.65,12.44L18.16,12.39V12.47C18.16,13.58 17.68,14.57 16.93,15.27L20.24,21H18.05M18.16,7.74C17.63,7.74 17.21,8.16 17.21,8.68C17.21,9.21 17.63,9.63 18.16,9.63C18.68,9.63 19.11,9.21 19.11,8.68C19.11,8.16 18.68,7.74 18.16,7.74Z" />
41
- </g>
42
-
43
- </svg>
94
+ <!-- The buttons must have class "btn" and an unique id="<scene-name>"
95
+ The scenes elements must have class "scene" and "scene-<scene-name>" -->
96
+ <div :id="id" v-html="svg"></div>
44
97
  </template>
@@ -3,15 +3,18 @@ import { toRefs, ref, computed } from "vue";
3
3
  import { mdiChevronLeftCircleOutline } from "@mdi/js";
4
4
  import { mdiChevronRightCircleOutline } from "@mdi/js";
5
5
  import { type MediaCarousel } from "../../types/MediaCarousel";
6
- import { type SizeThumbnail } from "../../types/Image";
6
+ import { InfoModal, type SizeThumbnail } from "../../types/Image";
7
7
  import EpIcon from "../basics/EpIcon.vue";
8
8
  import EpBtn from "../basics/EpBtn.vue";
9
9
  import EpModal from "../interactions/EpModal.vue";
10
10
  import EpImg from "../basics/EpImg.vue";
11
+ import EpImgCarousel from "../basics/EpImgCarousel.vue";
11
12
 
12
13
  interface Props {
13
14
  carrouselImg: MediaCarousel[];
15
+ title?: string;
14
16
  gallery?: boolean;
17
+ puzzle?: boolean;
15
18
  sizeThumbnail?: SizeThumbnail;
16
19
  isCenter?:boolean;
17
20
  labelClose?:string;
@@ -22,6 +25,7 @@ interface Props {
22
25
  const props = withDefaults(defineProps<Props>(), {
23
26
  gallery: false,
24
27
  isCenter:false,
28
+ puzzle:false,
25
29
  sizeThumbnail: "medium",
26
30
  labelRef:"Référence",
27
31
  labelClose:"Fermer",
@@ -29,6 +33,7 @@ const props = withDefaults(defineProps<Props>(), {
29
33
  });
30
34
 
31
35
 
36
+ // Logique Carousel normal
32
37
  const currentIndex = ref<number>(0);
33
38
  const dialog = ref<boolean>(false);
34
39
 
@@ -48,19 +53,53 @@ const nextSlide = () => {
48
53
 
49
54
  const isCenterStyle = computed(()=> {
50
55
  return props.isCenter ? 'justify-center':''
51
- })
56
+ });
57
+
58
+
59
+
60
+ // Logique Carousel gallery
61
+ const managedIndex = ref(0);
62
+ const managedInfoModal = ref({ src: '', caption: '', bib: ''} as InfoModal);
63
+
64
+
65
+ const newFocus = (index: number) => {
66
+ managedIndex.value = index;
67
+ managedInfoModal.value = { src: props.carrouselImg[index].src, caption: props.carrouselImg[index].caption, bib: props.carrouselImg[index].bib };
68
+ }
69
+
70
+ const managedPrevSlide = () => {
71
+ const isFirstSlide = managedIndex.value === 0;
72
+ const newIndex = isFirstSlide
73
+ ? props.carrouselImg.length - 1
74
+ : managedIndex.value - 1;
75
+ managedIndex.value = newIndex;
76
+ managedInfoModal.value = { src: props.carrouselImg[newIndex].src, caption: props.carrouselImg[newIndex].caption, bib: props.carrouselImg[newIndex].bib };
77
+ }
78
+
79
+ const managedNextSlide = () => {
80
+ const isTheLastSlide = managedIndex.value === props.carrouselImg.length - 1;
81
+ const newIndex = isTheLastSlide ? 0 : managedIndex.value + 1;
82
+ managedIndex.value = newIndex;
83
+ managedInfoModal.value = { src: props.carrouselImg[newIndex].src, caption: props.carrouselImg[newIndex].caption, bib: props.carrouselImg[newIndex].bib };
84
+ }
85
+
86
+
52
87
 
53
88
  const { carrouselImg, sizeThumbnail } = toRefs(props);
54
89
  </script>
55
90
 
56
91
  <template>
92
+
93
+ <h2 v-if="props.title" class="text-xl font-semibold mt-10 mb-4 text-center">{{ props.title }}</h2>
94
+
95
+
57
96
  <div v-if="!gallery">
58
97
  <div class="flex items-center justify-center mb-2">
59
- <button @click="prevSlide">
98
+ <button class="p-2" @click="prevSlide">
60
99
  <EpIcon :icon-path="mdiChevronLeftCircleOutline"></EpIcon>
61
100
  </button>
62
101
  {{ currentIndex + 1 }}/{{ carrouselImg.length }}
63
- <button @click="nextSlide">
102
+ <button class="p-2" @click="nextSlide">
64
103
  <EpIcon :icon-path="mdiChevronRightCircleOutline"></EpIcon>
65
104
  </button>
66
105
  </div>
@@ -77,12 +116,12 @@ const { carrouselImg, sizeThumbnail } = toRefs(props);
77
116
  <img
78
117
  :src="carrouselImg[currentIndex].src"
79
118
  alt="image"
80
- class="rounded-sm"
119
+ class="rounded-sm m-auto"
81
120
  />
82
121
 
83
122
  <div
84
123
  v-if="carrouselImg[currentIndex]?.caption"
85
- class="mt-2 text-sm text-base-dark dark:text-white"
124
+ class="mt-2 text-sm text-center text-base-dark dark:text-white"
86
125
  >
87
126
  {{ carrouselImg[currentIndex].caption }}
88
127
  </div>
@@ -99,19 +138,43 @@ const { carrouselImg, sizeThumbnail } = toRefs(props);
99
138
  </div>
100
139
  </EpModal>
101
140
  </div>
102
- <div v-else :class="`flex flex-wrap ${isCenterStyle}`">
103
- <template v-for="image in carrouselImg" :key="`image-${image?.uid}`">
104
- <EpImg
141
+
142
+ <div v-else-if="!puzzle" :class="`flex flex-wrap ${isCenterStyle}`">
143
+ <template v-for="(image, index) in carrouselImg" :key="`image-${image?.uid}`">
144
+ <EpImgCarousel
105
145
  :src="image.src"
106
146
  :bib="image.bib"
107
147
  :caption="image.caption"
108
148
  :label-ref="labelRef"
109
149
  :label-close="labelClose"
110
- thumbnail
111
150
  :size-thumbnail="sizeThumbnail"
112
- ></EpImg>
151
+ managed-modal
152
+ @new-focus="newFocus(index)"
153
+ :info-modal="managedInfoModal"
154
+ @prev-slide="managedPrevSlide"
155
+ @next-slide="managedNextSlide"
156
+ ></EpImgCarousel>
157
+ </template>
158
+ </div>
159
+
160
+ <div v-else-if="puzzle" :class="`columns-3xs mx-5 gap-2`">
161
+ <template v-for="(image, index) in carrouselImg" :key="`image-${image?.uid}`">
162
+ <EpImgCarousel
163
+ :src="image.src"
164
+ :bib="image.bib"
165
+ :caption="image.caption"
166
+ :label-ref="labelRef"
167
+ :label-close="labelClose"
168
+ puzzle
169
+ managed-modal
170
+ @new-focus="newFocus(index)"
171
+ :info-modal="managedInfoModal"
172
+ @prev-slide="managedPrevSlide"
173
+ @next-slide="managedNextSlide"
174
+ ></EpImgCarousel>
113
175
  </template>
114
176
  </div>
177
+
115
178
  </template>
116
179
 
117
180
  <style scoped>
@@ -102,7 +102,7 @@ const { event } = toRefs(props)
102
102
 
103
103
  <template>
104
104
  <div
105
- :class="`cursor-pointer ml-10 relative flex items-center p-2 ${colorEvent.border} border border-2 rounded-r-lg mb-8 flex-col md:flex-row space-y-4 md:space-y-0`"
105
+ :class="`cursor-pointer ml-10 relative flex items-center p-2 ${colorEvent.border} border-2 rounded-r-lg mb-8 flex-col md:flex-row space-y-4 md:space-y-0`"
106
106
  @click="toggleDivVisibility">
107
107
  <!-- Dot -->
108
108
  <div
@@ -1,4 +0,0 @@
1
- import { a5 as f } from "./index-BFsz449L.js";
2
- export {
3
- f as default
4
- };
@@ -1,4 +0,0 @@
1
- import { a6 as f } from "./index-BFsz449L.js";
2
- export {
3
- f as default
4
- };