fcad-core-dragon 2.0.0-beta.1 → 2.0.0-beta.10

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 (163) hide show
  1. package/.editorconfig +6 -31
  2. package/.prettierrc +11 -0
  3. package/.vscode/extensions.json +8 -0
  4. package/.vscode/settings.json +16 -0
  5. package/CHANGELOG +153 -0
  6. package/README.md +28 -43
  7. package/documentation/.vitepress/config.js +114 -0
  8. package/documentation/api-examples.md +49 -0
  9. package/documentation/composants/app-base-button.md +58 -0
  10. package/documentation/composants/app-base-error-display.md +59 -0
  11. package/documentation/composants/app-base-popover.md +68 -0
  12. package/documentation/composants/app-comp-audio.md +75 -0
  13. package/documentation/composants/app-comp-branch-buttons.md +111 -0
  14. package/documentation/composants/app-comp-button-progress.md +53 -0
  15. package/documentation/composants/app-comp-carousel.md +53 -0
  16. package/documentation/composants/app-comp-container.md +53 -0
  17. package/documentation/composants/app-comp-input-checkbox-next.md +42 -0
  18. package/documentation/composants/app-comp-input-dropdown-next.md +34 -0
  19. package/documentation/composants/app-comp-input-radio-next.md +39 -0
  20. package/documentation/composants/app-comp-input-text-next.md +35 -0
  21. package/documentation/composants/app-comp-input-text-table-next.md +34 -0
  22. package/documentation/composants/app-comp-input-text-to-fill-dropdown-next.md +53 -0
  23. package/documentation/composants/app-comp-input-text-to-fill-next.md +31 -0
  24. package/documentation/composants/app-comp-jauge.md +31 -0
  25. package/documentation/composants/app-comp-menu-item.md +55 -0
  26. package/documentation/composants/app-comp-menu.md +29 -0
  27. package/documentation/composants/app-comp-navigation.md +41 -0
  28. package/documentation/composants/app-comp-note-call.md +53 -0
  29. package/documentation/composants/app-comp-note-credit.md +53 -0
  30. package/documentation/composants/app-comp-play-bar-next.md +53 -0
  31. package/documentation/composants/app-comp-pop-up-next.md +93 -0
  32. package/documentation/composants/app-comp-quiz-next.md +235 -0
  33. package/documentation/composants/app-comp-quiz-recall.md +53 -0
  34. package/documentation/composants/app-comp-svg-next.md +53 -0
  35. package/documentation/composants/app-comp-table-of-content.md +50 -0
  36. package/documentation/composants/app-comp-video-player.md +82 -0
  37. package/documentation/composants.md +46 -0
  38. package/documentation/composants_critiques/ModelPageComposant.md +53 -0
  39. package/documentation/composants_critiques/app-base-module.md +43 -0
  40. package/documentation/composants_critiques/app-base-page.md +48 -0
  41. package/documentation/composants_critiques/app-base.md +311 -0
  42. package/documentation/composants_critiques/main.md +15 -0
  43. package/documentation/demarrage.md +50 -0
  44. package/documentation/deploiement.md +58 -0
  45. package/documentation/index.md +33 -0
  46. package/documentation/markdown-examples.md +85 -0
  47. package/documentation/public/npm_version.png +0 -0
  48. package/documentation/public/vite.svg +15 -0
  49. package/documentation/public/vuejs.svg +2 -0
  50. package/documentation/public/vuetify.svg +6 -0
  51. package/eslint.config.js +60 -0
  52. package/package.json +43 -47
  53. package/src/$locales/en.json +86 -108
  54. package/src/$locales/fr.json +66 -127
  55. package/src/assets/data/onboardingMessages.json +1 -1
  56. package/src/components/AppBase.vue +960 -405
  57. package/src/components/AppBaseButton.test.js +21 -0
  58. package/src/components/AppBaseButton.vue +42 -10
  59. package/src/components/AppBaseErrorDisplay.vue +207 -189
  60. package/src/components/AppBaseFlipCard.vue +1 -0
  61. package/src/components/AppBaseModule.vue +769 -977
  62. package/src/components/AppBasePage.vue +635 -81
  63. package/src/components/AppBasePopover.vue +41 -0
  64. package/src/components/AppBaseSkeleton.vue +66 -0
  65. package/src/components/AppCompAudio.vue +256 -0
  66. package/src/components/AppCompBranchButtons.vue +79 -153
  67. package/src/components/AppCompButtonProgress.vue +21 -36
  68. package/src/components/AppCompCarousel.vue +231 -87
  69. package/src/components/{AppCompTranscript.vue → AppCompContainer.vue} +12 -2
  70. package/src/components/AppCompInputCheckBoxNx.vue +323 -0
  71. package/src/components/AppCompInputDropdownNx.vue +299 -0
  72. package/src/components/AppCompInputRadioNx.vue +284 -0
  73. package/src/components/AppCompInputTextNx.vue +153 -0
  74. package/src/components/AppCompInputTextTableNx.vue +202 -0
  75. package/src/components/AppCompInputTextToFillDropdownNx.vue +340 -0
  76. package/src/components/AppCompInputTextToFillNx.vue +313 -0
  77. package/src/components/AppCompJauge.vue +36 -10
  78. package/src/components/AppCompMenu.vue +246 -32
  79. package/src/components/AppCompMenuItem.vue +87 -21
  80. package/src/components/AppCompNavigation.vue +470 -447
  81. package/src/components/AppCompNoteCall.vue +93 -58
  82. package/src/components/AppCompNoteCredit.vue +423 -96
  83. package/src/components/AppCompPlayBarNext.vue +2288 -0
  84. package/src/components/AppCompPopUpNext.vue +504 -0
  85. package/src/components/AppCompQuizNext.vue +510 -0
  86. package/src/components/AppCompQuizRecall.vue +199 -99
  87. package/src/components/AppCompSVGNext.vue +346 -0
  88. package/src/components/AppCompSettingsMenu.vue +17 -16
  89. package/src/components/AppCompTableOfContent.vue +262 -99
  90. package/src/components/AppCompVideoPlayer.vue +183 -142
  91. package/src/components/BaseModule.vue +8 -20
  92. package/src/components/tests__/AppBaseButton.spec.js +53 -0
  93. package/src/components/tests__/useTimer.spec.js +91 -0
  94. package/src/composables/useIdleDetector.js +56 -0
  95. package/src/composables/useQuiz.js +89 -0
  96. package/src/composables/useTimer.js +172 -0
  97. package/src/directives/nvdaFix.js +53 -0
  98. package/src/externalComps/ModuleView.vue +22 -0
  99. package/src/externalComps/SummaryView.vue +91 -0
  100. package/src/main.js +397 -148
  101. package/src/module/stores/appStore.js +947 -0
  102. package/src/module/xapi/ADL.js +241 -60
  103. package/src/module/xapi/Crypto/Hasher.js +8 -8
  104. package/src/module/xapi/Crypto/WordArray.js +6 -6
  105. package/src/module/xapi/Crypto/algorithms/BufferedBlockAlgorithm.js +4 -4
  106. package/src/module/xapi/Crypto/algorithms/C_algo.js +14 -18
  107. package/src/module/xapi/Crypto/algorithms/HMAC.js +1 -1
  108. package/src/module/xapi/Crypto/algorithms/SHA1.js +1 -1
  109. package/src/module/xapi/Crypto/encoders/Base.js +7 -7
  110. package/src/module/xapi/Crypto/encoders/Base64.js +3 -3
  111. package/src/module/xapi/Crypto/encoders/Hex.js +2 -2
  112. package/src/module/xapi/Crypto/encoders/Latin1.js +3 -3
  113. package/src/module/xapi/Crypto/encoders/Utf8.js +3 -3
  114. package/src/module/xapi/Statement/index.js +3 -3
  115. package/src/module/xapi/launch.js +10 -10
  116. package/src/module/xapi/utils.js +17 -17
  117. package/src/module/xapi/wrapper.js +219 -214
  118. package/src/module/xapi/xapiStatement.js +29 -29
  119. package/src/plugins/analytics.js +34 -0
  120. package/src/plugins/bus.js +7 -2
  121. package/src/plugins/gsap.js +5 -7
  122. package/src/plugins/helper.js +97 -34
  123. package/src/plugins/i18n.js +13 -18
  124. package/src/plugins/idb.js +45 -30
  125. package/src/plugins/save.js +1 -1
  126. package/src/plugins/scorm.js +15 -15
  127. package/src/plugins/xapi.js +2 -2
  128. package/src/public/index.html +22 -10
  129. package/src/router/index.js +29 -13
  130. package/src/router/routes.js +29 -54
  131. package/src/shared/generalfuncs.js +186 -30
  132. package/src/shared/validators.js +809 -40
  133. package/vitest.config.js +19 -0
  134. package/.eslintignore +0 -29
  135. package/.eslintrc.js +0 -86
  136. package/.prettierrc.js +0 -5
  137. package/babel.config.js +0 -3
  138. package/src/components/AppBaseDragChoice.vue +0 -91
  139. package/src/components/AppBaseDropZone.vue +0 -112
  140. package/src/components/AppCompBif.vue +0 -120
  141. package/src/components/AppCompDragAndDrop.vue +0 -339
  142. package/src/components/AppCompInputAssociation.vue +0 -332
  143. package/src/components/AppCompInputCheckBox.vue +0 -227
  144. package/src/components/AppCompInputDropdown.vue +0 -184
  145. package/src/components/AppCompInputRadio.vue +0 -169
  146. package/src/components/AppCompInputTextBox.vue +0 -91
  147. package/src/components/AppCompInputTextTable.vue +0 -155
  148. package/src/components/AppCompInputTextToFillDropdown.vue +0 -255
  149. package/src/components/AppCompInputTextToFillText.vue +0 -164
  150. package/src/components/AppCompMediaPlayer.vue +0 -397
  151. package/src/components/AppCompPlayBar.vue +0 -1319
  152. package/src/components/AppCompPopUp.vue +0 -522
  153. package/src/components/AppCompPopover.vue +0 -27
  154. package/src/components/AppCompQuiz.vue +0 -2989
  155. package/src/components/AppCompSVG.vue +0 -309
  156. package/src/mixins/$pageMixins.js +0 -459
  157. package/src/mixins/$quizMixins.js +0 -456
  158. package/src/mixins/timerMixin.js +0 -156
  159. package/src/module/store.js +0 -895
  160. package/src/plugins/timeManager.js +0 -77
  161. package/src/routes_bckp.js +0 -313
  162. package/src/routes_static.js +0 -344
  163. package/vue.config.js +0 -83
@@ -1,21 +1,41 @@
1
- const allfile = require.context('@/', true, /\.vue$/) //get all .vue file at the root of the project where lib will be installed
1
+ // const allfile = require.context('@/', true, /\.vue$/) //get all .vue file at the root of the project where lib will be installed
2
+ const allfile = import.meta.glob(['@/**/*.vue', '!@/**/_*'], {
3
+ eager: true
4
+ }) //get all .vue file at the root of the project where lib will be installed
5
+
6
+ const allfileKeys = Object.keys(allfile)
7
+
8
+ //console.log('ALL PATHS', fileArray)
9
+ allfileKeys.forEach(function (key, index, array) {
10
+ array[index] = {
11
+ name: key.replace('/src', '.').replace('.vue', ''),
12
+ fullPath: allfile[key].default.__file,
13
+ content: allfile[key].default
14
+ }
15
+ })
2
16
 
3
17
  const fileAssets = {
4
18
  // return the collection of all the files in the project directory
5
- allFiles: () => allfile.keys(),
19
+ allFiles: () => allfileKeys,
6
20
 
7
21
  // Return all the file in './views' with the Name Module
8
22
  getViews: () => {
9
- return fileAssets.allFiles().filter((file) => file.startsWith('./views'))
23
+ return fileAssets
24
+ .allFiles()
25
+ .filter(
26
+ (file) =>
27
+ file.name.startsWith('./views') &&
28
+ !file.name.split('/')[2].includes('copy')
29
+ )
10
30
  },
11
31
  // return all files that are in the folder './src/module' of the project with name respecting following condition:
12
32
  // must start with a capital P followed by a digit (P0, P1, P2...) and not contain keyword "copy"
13
33
  getActivities: () => {
14
34
  return fileAssets.allFiles().filter((file) => {
15
35
  if (
16
- file.startsWith('./module/A') &&
17
- /^P[0-9]{2,3}/.test(file.split('/')[3]) &&
18
- !file.split('/')[3].includes('copy')
36
+ file.name.startsWith('./module/A') &&
37
+ /^P[0-9]{2,3}/.test(file.name.split('/')[3]) &&
38
+ !file.name.split('/')[3].includes('copy')
19
39
  )
20
40
  return true
21
41
  else return false
@@ -23,7 +43,7 @@ const fileAssets = {
23
43
  },
24
44
 
25
45
  // search a specific file and return its content
26
- fetchFileContent: (file) => allfile(file),
46
+ fetchFileContent: (file) => allfile[file].default,
27
47
 
28
48
  /**
29
49
  * @description Validator for the content of menu setting file
@@ -33,7 +53,7 @@ const fileAssets = {
33
53
  */
34
54
  validatefileContent: (fName, fData, requiredArgs = {}) => {
35
55
  let err = null
36
- if (process.env.NODE_ENV === 'development') {
56
+ if (import.meta.env.DEV) {
37
57
  switch (fName) {
38
58
  case 'menuSettings': {
39
59
  const { keys4Activity, keys4Anchors } = requiredArgs
@@ -116,18 +136,18 @@ const fileAssets = {
116
136
  */
117
137
  buildMapTree: (a) => {
118
138
  // Load files in module folder
139
+
119
140
  if (a.length < 0) return
120
141
 
121
142
  const mapTree = new Map()
122
143
  // There is a file in the module folder
123
144
 
124
- a.forEach((key) => {
125
- const fileRef = key.replace(/(\.\/)/g, '')
145
+ a.forEach((e) => {
146
+ const fileRef = e.name.replace(/(\.\/)/g, '')
126
147
  const splitted = fileRef.split('/')
127
148
  const activityName = splitted[1]
128
149
  const fileName = splitted[splitted.length - 1].replace(/(\.vue)/g, '')
129
- const fileContent = fileAssets.fetchFileContent(`./${fileRef}`).default
130
-
150
+ const fileContent = e.content
131
151
  if (!Object.keys(fileContent).includes('data')) return
132
152
  // Handling single page type
133
153
  // adding the page in a map for the Pages
@@ -140,7 +160,8 @@ const fileAssets = {
140
160
  if (fileName.length === 3) {
141
161
  mapTree.get(activityName).set(fileName, {
142
162
  ref: fileRef,
143
- content: fileContent.data()
163
+ content: fileContent.data(),
164
+ fullPath: e.fullPath
144
165
  }) // add entry for the page
145
166
  }
146
167
  // Handleling Groupe page type
@@ -158,30 +179,165 @@ const fileAssets = {
158
179
  if (!mapTree.get(activityName).get(keyToFind).size) {
159
180
  mapTree.get(activityName).set(keyToFind, new Map())
160
181
  // Update reference of key's
161
- mapTree
162
- .get(activityName)
163
- .get(keyToFind)
164
- .set(keyToFind, tempSave)
182
+ mapTree.get(activityName).get(keyToFind).set(keyToFind, tempSave)
165
183
  }
166
184
 
167
185
  // Add page EXX in Map if it is not already added
168
- if (
169
- !mapTree
170
- .get(activityName)
171
- .get(keyToFind)
172
- .get(KeyToAdd)
173
- )
174
- mapTree
175
- .get(activityName)
176
- .get(keyToFind)
177
- .set(fileName, {
178
- ref: fileRef,
179
- content: fileContent.data()
180
- })
186
+ if (!mapTree.get(activityName).get(keyToFind).get(KeyToAdd))
187
+ mapTree.get(activityName).get(keyToFind).set(fileName, {
188
+ ref: fileRef,
189
+ content: fileContent.data(),
190
+ fullPath: e.fullPath
191
+ })
181
192
  }
182
193
  })
183
194
 
184
195
  return mapTree
196
+ },
197
+
198
+ /**
199
+ * @description Capitalize word in string
200
+ * @param {String} a- array of file for use case
201
+ * @param {Object} [requiredArgs] list of arguments to include consider in validation ()
202
+ */
203
+ capitalize: (string) => {
204
+ let formatted = string.replaceAll('_', ' ').toLowerCase()
205
+ formatted = `${formatted.substring(0, 1).toUpperCase()}${formatted.slice(1).toLowerCase()}`
206
+ return formatted
207
+ },
208
+
209
+ /**
210
+ * @description compares 2 array
211
+ * @param {Array} array1
212
+ * @param {Array} array2
213
+ * @returns {Boolean}
214
+ */
215
+ isEqual: (array1, array2) => {
216
+ // if length is not equal
217
+ if (array1.length != array2.length) {
218
+ return false
219
+ } else {
220
+ // comapring each element of array
221
+ for (let i = 0; i < array1.length; i++) {
222
+ if (array1[i] != array2[i]) {
223
+ return false
224
+ }
225
+ }
226
+ return true
227
+ }
228
+ },
229
+ /**
230
+ * @description used by the dropdown quiz
231
+ * @param {Array} answers what the user has answered
232
+ * @param {Array} solution the correct choices
233
+ * @returns {Boolean}
234
+ */
235
+ compareSelectedAnswers: (answers, solution) => {
236
+ for (let index = 0; index < answers.length; index++) {
237
+ const elementAnswers = answers[index]
238
+ const elementSolution = solution[index]
239
+ if (elementAnswers.reponse_id !== elementSolution) {
240
+ return false
241
+ }
242
+ }
243
+ return true
244
+ },
245
+
246
+ /**
247
+ * @description used by the texte_troue_select quiz
248
+ * @param {Array} answers what the user has answered
249
+ * @param {Array} solution the correct choices
250
+ * @returns {Boolean}
251
+ */
252
+ compareSelectedTextToFillAnswers: (answers, solution) => {
253
+ for (let index = 0; index < answers.length; index++) {
254
+ const elementAnswers = answers[index]
255
+ const elementSolution = Object.values(solution[index])[0]
256
+ if (elementAnswers.reponse_id !== elementSolution) {
257
+ return false
258
+ }
259
+ }
260
+ return true
261
+ },
262
+
263
+ /**
264
+ * @description used by the texte_tableau quiz and texte_troue quiz
265
+ * @param {Array} answers what the user has answered
266
+ * @param {Array} solution the correct choices
267
+ * @returns {Boolean}
268
+ */
269
+ compareTextAnswers: (answers, solution) => {
270
+ for (let index = 0; index < answers.length; index++) {
271
+ const elementAnswers = answers[index]
272
+ const elementSolution = solution[index]
273
+ if (
274
+ !this.$helper.containsValue(
275
+ elementSolution.reponse_value,
276
+ elementAnswers.reponse
277
+ )
278
+ ) {
279
+ return false
280
+ }
281
+ }
282
+ return true
283
+ },
284
+
285
+ /**
286
+ * @description used by the texte_tableau quiz and texte_troue quiz
287
+ * @param {Array} answers what the user has answered
288
+ * @param {Array} solution the correct choices
289
+ * @returns {Boolean}
290
+ */
291
+ compareTextAnswers2: (answers, solution) => {
292
+ for (let index = 0; index < answers.length; index++) {
293
+ const elementAnswers = answers[index]
294
+ const elementSolution = solution[index]
295
+ if (
296
+ !this.$helper.containsValue(
297
+ Object.values(elementSolution)[0],
298
+ elementAnswers.reponse
299
+ )
300
+ ) {
301
+ return false
302
+ }
303
+ }
304
+ return true
305
+ },
306
+
307
+ /**
308
+ * @description used by the association quiz
309
+ * @param {Object} answers what the user has answered
310
+ * @param {Object} solution the correct choices
311
+ * @returns {Boolean}
312
+ */
313
+ compareObjectAnswers: (answers, solution) => {
314
+ let answersKey = Object.keys(answers)
315
+ for (let index = 0; index < answersKey.length; index++) {
316
+ const elementAnswers = answers[answersKey[index]]
317
+ const elementSolution = solution[answersKey[index]]
318
+ if (elementAnswers !== elementSolution) {
319
+ return false
320
+ }
321
+ }
322
+ return true
323
+ },
324
+
325
+ /**
326
+ * @description used by the dragdrop quiz
327
+ * @param {Object} answers what the user has answered
328
+ * @param {Object} solution the correct choices
329
+ * @returns {Boolean}
330
+ */
331
+ compareObjectAnswers2: (answers, solution) => {
332
+ let answersKey = Object.keys(answers)
333
+ for (let index = 0; index < answersKey.length; index++) {
334
+ const elementAnswers = answers[answersKey[index]]
335
+ const elementSolution = solution[answersKey[index]]
336
+ if (!this.isEqual(elementAnswers, elementSolution)) {
337
+ return false
338
+ }
339
+ }
340
+ return true
185
341
  }
186
342
  }
187
343