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
@@ -6,159 +6,486 @@
6
6
  @ What it does:
7
7
  -->
8
8
  <template>
9
- <div class="noteCredit" :class="{ openW: showWidget }">
10
- <app-base-button id="close-toc" @click="close()">X</app-base-button>
11
-
12
- <div>
13
- <p>{{ $t('text.title_credit') }}</p>
14
-
15
- <ul v-if="credits != null">
16
- <li
17
- v-for="(credit, index) of credits"
18
- :key="`note_${index}`"
19
- :ref="`#nt_${index + 1}`"
20
- v-html="credit"
21
- ></li>
22
- </ul>
23
- <p v-else>{{ $t('text.no_credit') }}</p>
24
- </div>
25
- <div>
26
- <p>{{ $t('text.title_note') }}</p>
27
- <ul v-if="notes != null">
28
- <li
29
- v-for="(note, index) of notes"
30
- :id="`nt_${index + 1}`"
31
- :key="`note_${index}`"
32
- :dataRef="`rnt_${index + 1}`"
33
- class="widget-note"
34
- >
35
- <button
36
- :noteRef="`rnt_${index + 1}`"
37
- class="btn backToNoteRef"
38
- @click="focusNote($event)"
39
- >
40
- <span v-html="note"></span>
41
- </button>
42
- </li>
43
- </ul>
44
-
45
- <p v-else>{{ $t('text.no_note') }}</p>
9
+ <div id="noteCredit" :class="{ openW: showWidget }">
10
+ <app-base-button
11
+ id="close-nc"
12
+ :title="$t('button.closePopUp')"
13
+ :aria-label="$t('button.closePopUp')"
14
+ @click="close()"
15
+ >
16
+ <svg aria-hidden="true" focusable="false">
17
+ <use href="#close-square-icon" />
18
+ </svg>
19
+ </app-base-button>
20
+ <div class="box-nc">
21
+ <app-base-error-display
22
+ v-if="errorData.length"
23
+ :error-group="'component'"
24
+ :error-title="'ERREUR: NOTES ET CREDITS'"
25
+ :errors-list="errorData"
26
+ :error-text="`Vous avez une/des erreur(s) dans la création des notes/crédits.`"
27
+ ></app-base-error-display>
28
+ <template v-else>
29
+ <div v-if="notes" class="ctn-note">
30
+ <p class="t-note">{{ $t('text.title_note') }}</p>
31
+ <div id="notes-list">
32
+ <template
33
+ v-for="(note, index) of notes"
34
+ :key="`nt_${note.page_ref}__${note.id.substring(3)}`"
35
+ >
36
+ <div class="note-item">
37
+ <span>{{ index + 1 }}.</span>
38
+ <app-base-button
39
+ :id="`nt_${note.page_ref}__${note.id.substring(3)}`"
40
+ type="button"
41
+ :title="$t('text.title_link_bas')"
42
+ class="backToNoteRef"
43
+ :data-ref="`rnt_${note.page_ref}__${note.id.substring(3)}`"
44
+ :note-ref="`rnt_${note.page_ref}__${note.id.substring(3)}`"
45
+ :pageref="note.page_ref"
46
+ :class="
47
+ note.hasError ? 'widget-note note-error' : 'widget-note'
48
+ "
49
+ @click="
50
+ handleNoteDisplay(
51
+ `nt_${note.page_ref}__${note.id.substring(3)}`
52
+ )
53
+ "
54
+ >
55
+ <div
56
+ class="btref-content"
57
+ data-content=""
58
+ v-html="`${note.text}`"
59
+ ></div>
60
+ </app-base-button>
61
+ </div>
62
+ </template>
63
+ </div>
64
+ </div>
65
+ <div v-if="credits" class="ctn-credit">
66
+ <p class="t-crdt">{{ $t('text.title_credit') }}</p>
67
+
68
+ <ul id="credits-list">
69
+ <li
70
+ v-for="(credit, index) of credits"
71
+ :key="`credit_${index + 1}`"
72
+ :ref="`#nt_${index + 1}`"
73
+ v-html="credit"
74
+ ></li>
75
+ </ul>
76
+ </div>
77
+ </template>
46
78
  </div>
47
79
  </div>
48
80
  </template>
49
81
  <script>
82
+ import { mapState, mapActions } from 'pinia'
83
+ import { useAppStore } from '../module/stores/appStore'
84
+ import { validateObjType } from '../shared/validators'
85
+
50
86
  export default {
87
+ props: {},
51
88
  data() {
52
89
  return {
53
- notes: null,
54
- credits: null,
55
90
  current: false,
56
- jsons: null,
57
- showWidget: false
91
+ showWidget: false,
92
+ sideBarIsOpen: null,
93
+ prevNote: null,
94
+ shouldDeactivate: false,
95
+ errorData: [],
96
+ notes: null,
97
+ credits: null
58
98
  }
59
99
  },
60
100
  computed: {
61
- error() {
62
- // ---------------- MUST BE REDO BECAUSE INFO CHANGE ----------------------
63
- let er = false
64
- // let info = this.jsons
65
- // if (info) {
66
- // if (Object.keys(info.note).length === 0) {
67
- // er = true
68
- // console.warn(
69
- // '%c WARNING!>>> AppCompNoteFin: Your note file is empty.',
70
- // 'background: orange; color: white; display: block; margin:5px;'
71
- // )
72
- // }
73
- // }
74
- return er
75
- }
101
+ ...mapState(useAppStore, [
102
+ 'getDataNoteCredit',
103
+ 'getAllActivities',
104
+ 'getCurrentPage',
105
+ 'getNotes',
106
+ 'getCredits'
107
+ ])
108
+ },
109
+ created() {},
110
+ beforeUnmount() {
111
+ this.$bus.$off('credit-note', this.onCreditNote)
112
+ this.$bus.$off('toggle-widget', this.onToggleWidget)
113
+ this.$bus.$off('close-widget', this.close)
114
+ this.$bus.$off('note-to-show', this.onNoteToShow)
115
+ this.$bus.$off('side-bar-open', this.onSidebarVisible)
76
116
  },
77
- async created() {},
78
117
  mounted() {
79
- this.$bus.$on('credit-note', (data) => {
80
- this.notes = data.note
81
- this.credits = data.credit
82
- })
83
-
84
118
  // close or open widget depending which btn was click
85
- this.$bus.$on('toggle-widget', (data) => {
86
- if (data == 'noteCredit') this.showWidget = !this.showWidget
87
- else this.showWidget = false
88
- })
89
-
119
+ this.$bus.$on('toggle-widget', this.onToggleWidget)
90
120
  //close widget
91
- this.$bus.$on('close-widget', (data) => {
92
- this.showWidget = false
93
- })
94
-
121
+ this.$bus.$on('close-widget', this.close)
95
122
  // show widget when note click and higligth note
96
- this.$bus.$on('note-to-show', (el) => {
123
+ this.$bus.$on('note-to-show', this.onNoteToShow)
124
+ this.$bus.$on('side-bar-open', this.onSidebarVisible)
125
+ },
126
+ methods: {
127
+ ...mapActions(useAppStore, ['updateWidgetOpen']),
128
+ getPageNotes(data) {
129
+ if (!data) return
130
+ const _notes = data
131
+ let formatedNotes = []
132
+ _notes.forEach((g) => {
133
+ let count = 0
134
+ Object.values(g)[0].map((n) => {
135
+ count++
136
+ if (
137
+ this.validateData('note', {
138
+ n,
139
+ details: `${count} ${Object.keys(g)[0]} `
140
+ })
141
+ )
142
+ return
143
+ n['page_ref'] = `${Object.keys(g)[0]}`
144
+ })
145
+ //Add all the note to the temp array
146
+ formatedNotes.push(...Object.values(g)[0])
147
+ })
148
+
149
+ return formatedNotes
150
+ },
151
+
152
+ getPageCredits(data) {
153
+ if (!data) return
154
+
155
+ let credits = data
156
+ let count = 0
157
+ for (const c of credits) {
158
+ count++
159
+ if (this.validateData('credit', { c, details: count })) return
160
+ }
161
+
162
+ return credits
163
+ },
164
+ setPageNotesAndCredits(data) {
165
+ const { notes, credits } = data
166
+ this.notes = this.getPageNotes(notes)
167
+ this.credits = this.getPageCredits(credits)
168
+ },
169
+ /**
170
+ * @description method to validate that the data for the note and credit.
171
+ * @param {String} ctx context of the validation : credit | note.
172
+ * @param {String| Object} data the data to be validate- Object type for note and String type for credit
173
+ * @return {boolean}
174
+ */
175
+ validateData(ctx, data) {
176
+ let errConsole = []
177
+ if (this.errorData.length) this.errorData = [] //reset the error tracker
178
+
179
+ switch (ctx) {
180
+ case 'note': {
181
+ if (data.constructor !== Object) {
182
+ this.errorData.push(
183
+ "Mauvais d'éclaration de la note. Doit être de type <i>Objet</i>"
184
+ )
185
+ throw Error(
186
+ `Unexpected definition the note. Expecting Object but received ${typeof data}`
187
+ )
188
+ }
189
+
190
+ let stringType = ['id', 'text'] //expected attribute in the note declaration
191
+
192
+ let { errorInConsole, errorList } = validateObjType(
193
+ data.n,
194
+ {
195
+ stringType
196
+ },
197
+ null,
198
+ `Note ${data.details}`
199
+ )
200
+
201
+ if (errorInConsole.length) errConsole.push(...errorInConsole)
202
+ if (errorList.length) this.errorData.push(...errorList)
203
+ break
204
+ }
205
+ case 'credit':
206
+ if (data.c.constructor !== String) {
207
+ this.errorData.push(
208
+ `Mauvaise déclaration du <b>crédit ${data.details}</b>. Doit être de type <i>String</i>`
209
+ )
210
+ console.warn(
211
+ `\n 💥 Invalid type declaration for 👉\x1B[1mcredit ${data.details} 👈\x1B[0m. Expecting type String \uD83D\uDEABtype ${typeof data.c}`
212
+ )
213
+ }
214
+ }
215
+ if (errConsole.length) {
216
+ errConsole.forEach((err) => console.warn(err))
217
+ }
218
+ return this.errorData.length
219
+ },
220
+ onNoteToShow(el) {
97
221
  this.showWidget = true
222
+ this.updateWidgetOpen(true)
98
223
 
99
224
  if (el) {
100
- let ref = el.getAttribute('dataRef')
225
+ let ref = el.getAttribute('data-Ref')
101
226
 
102
- this.removefocus()
227
+ const reg1 = /.*(P\d{2}(_E\d{2})?).*/gm //reg for the content of data-ref
228
+ const id = `$1`
229
+ const pageRef = ref.replace(reg1, id) //replace all to page id
230
+
231
+ if (this.sideBarIsOpen && pageRef.length == 3)
232
+ this.$bus.$emit('close-sidebar', 'ctxBranching') //send close signal if sibebar is open and note to focus is in parent page
233
+
234
+ this.removehighlight()
103
235
 
104
236
  let elAtt = document.getElementsByClassName('widget-note')
105
- var arr = Array.from(elAtt)
237
+ let arr = Array.from(elAtt)
106
238
 
107
239
  for (let element of arr) {
108
240
  if (ref == element.getAttribute('id')) {
109
- element.setAttribute('dataCurrent', true)
241
+ element.setAttribute('datacurrent', true)
242
+ element.focus()
110
243
  }
111
244
  }
112
245
  }
113
- })
114
- },
115
- methods: {
116
- //close widget
117
- close() {
246
+ },
247
+
248
+ onToggleWidget(data) {
249
+ if (data.type !== 'noteCredit') return (this.showWidget = false)
250
+ const { notes, credits } = data.content
251
+
252
+ this.setPageNotesAndCredits({ notes, credits })
118
253
  this.showWidget = !this.showWidget
254
+ this.updateWidgetOpen(this.showWidget) //update data in store
119
255
  },
120
- removefocus() {
121
- let elAtt = document.querySelectorAll("[dataCurrent='true']")
256
+ close() {
257
+ let elNote = document.getElementsByClassName('widget-note')
258
+ let elCall = document.getElementsByClassName('callEndNote')
259
+
260
+ let arrNote = Array.from(elNote)
261
+ let arrCall = Array.from(elCall)
262
+
263
+ for (let element of arrNote) {
264
+ element.setAttribute('datacurrent', false)
265
+ }
122
266
 
123
- var arr = Array.from(elAtt)
267
+ for (let element of arrCall) {
268
+ element.setAttribute('datacurrentnote', false)
269
+ }
270
+ this.showWidget = false
271
+ this.updateWidgetOpen(false)
272
+ },
273
+ removehighlight() {
274
+ let elAtt = document.querySelectorAll("[datacurrent='true']")
275
+
276
+ let arr = Array.from(elAtt)
124
277
 
125
278
  for (let element of arr) {
126
- element.setAttribute('dataCurrent', false)
279
+ element.setAttribute('datacurrent', false)
127
280
  }
128
281
  },
129
- focusNote(el) {
282
+
283
+ focusNote(el, page) {
284
+ this.remove()
285
+ const DOMPages = document.getElementsByClassName(`app-page`)
286
+ const targetPage = DOMPages.namedItem(page) //get the desired page
287
+
130
288
  let e = document.getElementsByClassName('callEndNote')
131
- let t = el.target.getAttribute('noteref')
289
+
290
+ if (!targetPage) return
291
+ let nts = targetPage.getElementsByClassName('callEndNote')
292
+
293
+ let t = el.getAttribute('note-ref')
294
+ let s = document.querySelectorAll(`[data-ref="${t}"]`)
295
+
296
+ if (s && s[0]) s[0].setAttribute('datacurrent', true)
297
+
132
298
  for (let element of e) {
133
- element.setAttribute('dataCurrentnote', false)
134
- if (element.id === t) {
135
- element.setAttribute('dataCurrentnote', true)
299
+ element.setAttribute('datacurrentnote', false) //reset the data attribute of all notes
300
+ }
301
+ let targetNote = nts.namedItem(t)
302
+
303
+ if (targetNote) {
304
+ targetNote.setAttribute('datacurrentnote', true)
305
+
306
+ targetNote.childNodes[0].focus()
307
+ } else {
308
+ el.setAttribute('aria-disabled', 'true')
309
+ el.setAttribute('disabled', 'true')
310
+ el.querySelector('.btref-content').setAttribute(
311
+ 'data-content',
312
+ '\u26A0\uFE0F'
313
+ )
314
+ el.querySelector('div').style =
315
+ 'color:red; text-decoration:line-through;'
316
+ el.style.color = 'red'
317
+
318
+ el.removeEventListener('click', this.handleNoteDisplay)
319
+ }
320
+ this.prevNote = el
321
+ },
322
+
323
+ remove() {
324
+ let e = document.getElementsByClassName('widget-note')
325
+ for (let element of e) {
326
+ element.setAttribute('datacurrent', false)
327
+ }
328
+ },
329
+
330
+ onSidebarVisible(state) {
331
+ this.sideBarIsOpen = state
332
+ },
333
+
334
+ /**
335
+ * @description method handle the behavior of note displaying
336
+ * @param {Object} evt - the event that trigger the action
337
+ * @emits event - 'open-sidebar' to display notes in branch | 'close-sidebar' to display not in parent when branch open
338
+ *
339
+ */
340
+ handleNoteDisplay(ref) {
341
+ /*
342
+ * Note:
343
+ * Element target (button) is wrongly referenced when Screen-reader is active and element selected With TAB
344
+ * The Div in the button is selected not the button.
345
+ * This ensure that the button is always set as targeted element
346
+ */
347
+ const widgetContent = document.getElementsByClassName('backToNoteRef') //target all the button of in the notes widget
348
+ const elTarget = widgetContent.namedItem(ref) // Target current button
349
+ const pageRef = elTarget.getAttribute('pageref')
350
+
351
+ if (!this.sideBarIsOpen) this.prevNote = null //reset previous when sidebar is opened
352
+
353
+ let prevPageref = this.prevNote
354
+ ? this.prevNote.getAttribute('pageref')
355
+ : null
356
+
357
+ switch (true) {
358
+ case pageRef && pageRef.length > 3: {
359
+ //this is the branching page Send message to open the side bar
360
+ this.$bus.$emit('open-sidebar', {
361
+ ctx: 'ctxBranching',
362
+ e: pageRef,
363
+ persist: this.sideBarIsOpen || pageRef == prevPageref //this will prevent the sidebar to close when the note is in same page
364
+ })
365
+ //Should set focus after side bar is opened. Need to delay to not interfere with side bar focus
366
+ pageRef == prevPageref
367
+ ? setTimeout(() => this.focusNote(elTarget, pageRef), 100)
368
+ : setTimeout(() => this.focusNote(elTarget, pageRef), 400)
369
+
370
+ break
136
371
  }
372
+ default:
373
+ //Should have the side bar close if it is opened and note is in parent page
374
+ if (this.sideBarIsOpen && pageRef.length == 3)
375
+ this.$bus.$emit('close-sidebar', 'ctxBranching')
376
+
377
+ return setTimeout(() => this.focusNote(elTarget, pageRef), 100) //Need to delay to not have side bar close animation finished
137
378
  }
379
+
380
+ this.prevNote = elTarget
138
381
  }
139
382
  }
140
383
  }
141
384
  </script>
142
385
  <style lang="scss">
143
- .noteCredit {
386
+ #noteCredit {
387
+ display: none;
388
+ pointer-events: none;
144
389
  position: absolute;
390
+ left: 75px;
145
391
  top: 0;
146
- left: 200%;
147
- display: none;
148
- opacity: 0;
392
+ width: 419px;
393
+ transition: left 0.5s ease-in-out;
149
394
 
150
395
  &.openW {
396
+ pointer-events: all;
151
397
  display: block;
152
398
  opacity: 1;
153
399
  }
154
400
 
155
- span {
156
- pointer-events: none;
401
+ #close-nc {
402
+ padding: 11px;
403
+ position: absolute;
404
+ right: 24px;
405
+ margin-bottom: 0;
406
+
407
+ &:focus {
408
+ box-shadow: inherit !important;
409
+ }
410
+ }
411
+
412
+ // .note-txt {
413
+ // pointer-events: none;
414
+ // }
415
+
416
+ .box-nc {
417
+ margin-top: 54px;
418
+ overflow-y: auto;
419
+ min-height: 160px;
420
+ max-height: 321px;
421
+ padding-right: 26px;
422
+
423
+ .t-note {
424
+ margin-bottom: 8px;
425
+ }
426
+
427
+ #notes-list {
428
+ .note-item {
429
+ display: flex;
430
+ flex-direction: row;
431
+ flex-wrap: wrap;
432
+ margin-bottom: 5px;
433
+
434
+ color: #deeff8;
435
+
436
+ span {
437
+ font-size: 0.65rem;
438
+ padding: 8px 0 0 0;
439
+ }
440
+
441
+ .backToNoteRef {
442
+ width: 90%;
443
+ margin-left: 5px;
444
+ padding-left: 5px;
445
+
446
+ .btref-content {
447
+ text-align: left;
448
+ }
449
+ }
450
+ }
451
+ }
157
452
  }
158
453
 
454
+ #credits-list {
455
+ list-style-type: none;
456
+ padding: 0;
457
+ margin: 0;
458
+ }
459
+ #notes-list {
460
+ padding: 0;
461
+ margin: 0;
462
+
463
+ .widget-note {
464
+ padding: 5px 0;
465
+
466
+ &.note-error {
467
+ background-color: firebrick;
468
+ }
469
+
470
+ .btref-content {
471
+ pointer-events: none;
472
+ }
473
+ }
474
+ }
159
475
  .overlay-w {
160
476
  width: 100%;
161
477
  height: 100%;
162
478
  }
163
479
  }
480
+
481
+ .app-nav {
482
+ &.show,
483
+ &:hover {
484
+ .ctn-w {
485
+ #noteCredit {
486
+ left: 120px;
487
+ }
488
+ }
489
+ }
490
+ }
164
491
  </style>