@explorer-1/vue 0.2.43 → 0.2.44

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorer-1/vue",
3
- "version": "0.2.43",
3
+ "version": "0.2.44",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -28,7 +28,6 @@
28
28
  "twitter-widgets": "^2.0.0",
29
29
  "vue": "^3.4.21",
30
30
  "vue-bind-once": "^0.2.1",
31
- "vue-observe-visibility": "^1.0.0",
32
31
  "vue3-compare-image": "^1.2.5",
33
32
  "vue3-observe-visibility": "^1.0.1",
34
33
  "@explorer-1/common": "1.1.12"
@@ -1,13 +1,15 @@
1
1
  <template>
2
2
  <div v-if="data">
3
- <VueCompareImage
4
- v-if="theBeforeImageSrc && theAfterImageSrc"
5
- class="h-full animate-fadeIn"
6
- :left-image="theBeforeImageSrc.url"
7
- left-image-alt="Left image"
8
- :right-image="theAfterImageSrc.url"
9
- right-image-alt="Right image"
10
- />
3
+ <ClientOnly>
4
+ <VueCompareImage
5
+ v-if="theBeforeImageSrc && theAfterImageSrc"
6
+ class="h-full animate-fadeIn"
7
+ :left-image="theBeforeImageSrc.url"
8
+ left-image-alt="Left image"
9
+ :right-image="theAfterImageSrc.url"
10
+ right-image-alt="Right image"
11
+ />
12
+ </ClientOnly>
11
13
  <div
12
14
  v-if="data.caption || customDetailUrl"
13
15
  class="lg:px-0 p-4 pb-0 print:pl-0"
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, reactive, ref } from 'vue'
3
3
  import type {
4
- BlockData,
5
4
  ImageObject,
6
5
  PageEduResourcesObject,
7
6
  StreamfieldBlockData
@@ -24,13 +23,15 @@ import AboutTheAuthor from './../../../components/AboutTheAuthor/AboutTheAuthor.
24
23
  import { HeadingLevel } from '../../../components/BaseHeading/BaseHeading.vue'
25
24
 
26
25
  interface EduLessonSectionObject extends PageEduLessonSectionProps {
27
- type?: 'streamfield'
26
+ type?: string
28
27
  }
29
28
  interface EduLessonProcedureBlocks {
30
29
  blocks: StreamfieldBlockData[]
31
30
  }
32
- interface EduLessonProcedure {
33
- procedure: EduLessonProcedureBlocks
31
+ export interface EduLessonProcedure {
32
+ sectionHeading?: string
33
+ steps?: EduLessonProcedureBlocks[]
34
+ stepsNumbering?: boolean
34
35
  }
35
36
 
36
37
  interface PageEduLessonObject extends PageEduResourcesObject {
@@ -193,8 +194,8 @@ const consolidatedBlocks = computed(() => {
193
194
  } else if (section === 'procedures' && data.procedures?.length) {
194
195
  // get blocks in nested procedures
195
196
  data.procedures.forEach((item) => {
196
- if (item.procedure?.blocks?.length) {
197
- blocks.push(...item.procedure.blocks)
197
+ if (item.steps?.length) {
198
+ blocks.push(...item.steps)
198
199
  }
199
200
  })
200
201
  }
@@ -218,7 +219,7 @@ const consolidatedBlocks = computed(() => {
218
219
 
219
220
  // organize data to render with PageEduLessonSection component
220
221
  const consolidatedSections = computed((): EduLessonSectionObject[] => {
221
- const sections = []
222
+ const sections: EduLessonSectionObject[] = []
222
223
  // include custom top section
223
224
  if (keyedCustomSections.value && keyedCustomSections.value['top']) {
224
225
  sections.push({ type: 'streamfield', blocks: keyedCustomSections.value['top'] })
@@ -226,9 +227,7 @@ const consolidatedSections = computed((): EduLessonSectionObject[] => {
226
227
  sectionOrder.forEach((section) => {
227
228
  if (data && data[section]) {
228
229
  sections.push({
229
- heading: staticSectionHeadings.value
230
- ? (staticSectionHeadings.value[section] as BlockData)
231
- : undefined,
230
+ heading: staticSectionHeadings.value ? staticSectionHeadings.value[section] : undefined,
232
231
  blocks: section !== 'materials' && section !== 'procedures' ? data[section] : undefined,
233
232
  text: section === 'materials' ? data[section] : undefined,
234
233
  procedures: section === 'procedures' ? data[section] : undefined
@@ -243,7 +242,11 @@ const consolidatedSections = computed((): EduLessonSectionObject[] => {
243
242
  if (keyedCustomSections.value && keyedCustomSections.value['bottom']) {
244
243
  sections.push({ type: 'streamfield', blocks: keyedCustomSections.value['bottom'] })
245
244
  }
246
- return sections as EduLessonSectionObject[]
245
+ const filteredSections = sections.filter(
246
+ (item) => item.text !== undefined || item.blocks !== undefined || item.procedures !== undefined
247
+ )
248
+
249
+ return filteredSections
247
250
  })
248
251
  </script>
249
252
  <template>
@@ -332,7 +335,7 @@ const consolidatedSections = computed((): EduLessonSectionObject[] => {
332
335
  v-for="(value, _key) in consolidatedSections"
333
336
  :key="_key"
334
337
  >
335
- <template v-if="value.blocks?.length || value.procedures?.length">
338
+ <template v-if="value.blocks?.length || value.procedures?.length || value.text?.length">
336
339
  <BlockStreamfield
337
340
  v-if="value.type === 'streamfield'"
338
341
  :data="value.blocks"
@@ -5,6 +5,7 @@ import type { ImageObject, StreamfieldBlockData } from './../../../interfaces'
5
5
  import BlockHeading, {
6
6
  type BlockHeadingObject
7
7
  } from './../../../components/BlockHeading/BlockHeading.vue'
8
+ import type { EduLessonProcedure } from './PageEduLesson.vue'
8
9
  import BaseHeading from './../../../components/BaseHeading/BaseHeading.vue'
9
10
  import BlockText from './../../../components/BlockText/BlockText.vue'
10
11
  import LayoutHelper from './../../../components/LayoutHelper/LayoutHelper.vue'
@@ -12,15 +13,9 @@ import BlockImageStandard from './../../../components/BlockImage/BlockImageStand
12
13
  import BlockStreamfield from './../../../components/BlockStreamfield/BlockStreamfield.vue'
13
14
 
14
15
  export interface PageEduLessonSectionProps {
15
- heading: BlockHeadingObject
16
+ heading?: BlockHeadingObject
16
17
  blocks?: StreamfieldBlockData[]
17
- procedures?: {
18
- sectionHeading: string
19
- stepsNumbering: boolean
20
- steps: {
21
- blocks: StreamfieldBlockData[]
22
- }[]
23
- }[]
18
+ procedures?: EduLessonProcedure[]
24
19
  text?: string
25
20
  image?: ImageObject
26
21
  }
@@ -36,14 +31,14 @@ const props = withDefaults(defineProps<PageEduLessonSectionProps>(), {
36
31
  const { heading, blocks, image } = reactive(props)
37
32
 
38
33
  const anchorId = computed(() => {
39
- return 'lesson_' + camelCase(heading.heading)
34
+ return 'lesson_' + camelCase(heading?.heading)
40
35
  })
41
36
  </script>
42
37
  <template>
43
38
  <section
44
39
  :id="anchorId"
45
40
  class="PageEduLessonSection"
46
- :aria-label="heading.heading"
41
+ :aria-label="heading?.heading"
47
42
  >
48
43
  <LayoutHelper
49
44
  indent="col-3"