@explorer-1/vue 0.2.57 → 0.2.59

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 (30) hide show
  1. package/components.d.ts +2 -0
  2. package/dist/explorer-1-vue.js +5340 -5200
  3. package/dist/explorer-1-vue.umd.cjs +13 -13
  4. package/dist/src/components/BaseImage/BaseImage.stories.d.ts +1 -4
  5. package/dist/src/components/BaseImage/BaseImage.vue.d.ts +1 -4
  6. package/dist/src/components/BlockAudio/BlockAudio.vue.d.ts +1 -4
  7. package/dist/src/components/BlockCardGridItem/BlockCardGridItemElement.vue.d.ts +1 -4
  8. package/dist/src/components/BlockCircleImageCard/BlockCircleImageCard.vue.d.ts +1 -4
  9. package/dist/src/components/BlockTeaser/BlockTeaser.vue.d.ts +1 -4
  10. package/dist/src/components/BlockText/BlockText.stories.d.ts +13 -0
  11. package/dist/src/components/EventDetailHero/EventDetailHero.vue.d.ts +1 -4
  12. package/dist/src/components/HomepageFeaturedRobot/HomepageFeaturedRobot.vue.d.ts +1 -4
  13. package/dist/src/components/HomepageTeaserBlock/HomepageTeaserBlockCardImage.vue.d.ts +1 -4
  14. package/dist/src/components/ImageDetailContextImage/ImageDetailContextImage.vue.d.ts +1 -4
  15. package/dist/src/components/SearchFilterGroup/SearchFilterGroup.stories.d.ts +43 -0
  16. package/dist/src/components/SearchFilterGroup/SearchFilterGroup.vue.d.ts +121 -11
  17. package/dist/src/components/SearchFilterGroupAccordionItem/SearchFilterGroupAccordionItem.vue.d.ts +44 -0
  18. package/dist/src/components/SearchInput/SearchInput.vue.d.ts +11 -0
  19. package/dist/src/interfaces.d.ts +18 -0
  20. package/dist/src/templates/edu/PageEduHome/PageEduHome.stories.d.ts +70 -0
  21. package/dist/style.css +1 -1
  22. package/package.json +2 -2
  23. package/src/components/BlockRichTable/BlockRichTable.stories.js +55 -0
  24. package/src/components/BlockRichTable/BlockRichTable.vue +89 -0
  25. package/src/components/BlockStreamfield/BlockStreamfield.vue +11 -0
  26. package/src/components/PodcastSeriesCarousel/PodcastSeriesCarousel.vue +42 -22
  27. package/src/templates/PageAudioDetail/PageAudioDetail.vue +1 -0
  28. package/src/templates/PageImageDetail/PageImageDetail.vue +13 -36
  29. package/src/templates/www/PagePodcast/PagePodcast.vue +2 -2
  30. package/tsconfig.json +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorer-1/vue",
3
- "version": "0.2.57",
3
+ "version": "0.2.59",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -30,7 +30,7 @@
30
30
  "vue-bind-once": "^0.2.1",
31
31
  "vue3-compare-image": "^1.2.5",
32
32
  "vue3-observe-visibility": "^1.0.1",
33
- "@explorer-1/common": "1.1.14"
33
+ "@explorer-1/common": "1.1.15"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@vitejs/plugin-vue": "^5.0.4",
@@ -0,0 +1,55 @@
1
+ import BlockRichTable from './BlockRichTable.vue'
2
+ import { BlockImageData } from './../BlockImage/BlockImage.stories'
3
+
4
+ export default {
5
+ title: 'Components/Blocks/BlockRichTable',
6
+ component: BlockRichTable,
7
+ excludeStories: /.*Data$/
8
+ }
9
+
10
+ export const BlockRichTableData = {
11
+ blockType: 'RichTableBlock',
12
+ tableCaption: 'table caption',
13
+ tableContent: {
14
+ tableHead: [
15
+ [
16
+ {
17
+ text: '1. Learn why we study geology on Earth and other planets'
18
+ },
19
+ {
20
+ text: '1. Learn why we study geology on Earth and other planets'
21
+ }
22
+ ]
23
+ ],
24
+ tableBody: [
25
+ [
26
+ {
27
+ ...BlockImageData,
28
+ caption: '<p>My custom caption.</p>',
29
+ displayCaption: true,
30
+ blockType: 'ImageBlock'
31
+ },
32
+ { ...BlockImageData, blockType: 'ImageBlock' }
33
+ ],
34
+ [
35
+ {
36
+ blockType: 'CharBlock',
37
+ value:
38
+ "Geologists are scientists who study a planet's solid features, like soil, rocks, and minerals. There are all kinds of rocks and minerals that make up our planet – as well as the Moon, Mars, and other rocky worlds. By studying these features, we can learn more about how rocky worlds form and change over time."
39
+ },
40
+ {
41
+ blockType: 'CharBlock',
42
+ value:
43
+ "Geologists are scientists who study a planet's solid features, like soil, rocks, and minerals. There are all kinds of rocks and minerals that make up our planet – as well as the Moon, Mars, and other rocky worlds. By studying these features, we can learn more about how rocky worlds form and change over time."
44
+ }
45
+ ]
46
+ ]
47
+ }
48
+ }
49
+
50
+ export const BaseStory = {
51
+ name: 'BlockRichTable',
52
+ args: {
53
+ table: BlockRichTableData
54
+ }
55
+ }
@@ -0,0 +1,89 @@
1
+ <script lang="ts">
2
+ import { defineComponent } from 'vue'
3
+ import BlockImageStandard from './../BlockImage/BlockImageStandard.vue'
4
+ import BlockText from './../BlockText/BlockText.vue'
5
+
6
+ export default defineComponent({
7
+ name: 'BlockRichTable',
8
+ components: {
9
+ BlockImageStandard,
10
+ BlockText
11
+ },
12
+ props: {
13
+ table: {
14
+ type: Object,
15
+ required: true
16
+ }
17
+ }
18
+ })
19
+ </script>
20
+
21
+ <template>
22
+ <div
23
+ v-if="table"
24
+ class="BlockRichTable BlockText -small text-body-sm"
25
+ >
26
+ <div class="overflow-x-auto scrolling-touch max-w-screen-3xl mx-auto">
27
+ <table
28
+ class="min-w-full border-gray-light-mid w-full border-t border-b border-collapse table-auto"
29
+ >
30
+ <thead v-if="table.tableContent.tableHead?.length">
31
+ <tr>
32
+ <th
33
+ v-for="(headCell, headIndex) in table.tableContent.tableHead[0]"
34
+ :key="headIndex"
35
+ scope="col"
36
+ class="min-w-72 sm:min-w-80 bg-jpl-blue-darker text-subtitle text-white border-gray-light-mid lg:p-5 p-3 border-b"
37
+ >
38
+ {{ headCell.text }}
39
+ </th>
40
+ </tr>
41
+ </thead>
42
+ <tbody v-if="table.tableContent.tableBody?.length">
43
+ <tr
44
+ v-for="(row, rowIndex) in table.tableContent.tableBody"
45
+ :key="rowIndex"
46
+ >
47
+ <td
48
+ v-for="(cell, cellIndex) in row"
49
+ :key="cellIndex"
50
+ class="min-w-72 sm:min-w-80 bg-white text-gray-dark border-gray-light-mid"
51
+ >
52
+ <template v-if="cell.blockType === 'CharBlock'">
53
+ <p class="">
54
+ {{ cell.value }}
55
+ </p>
56
+ </template>
57
+ <template v-else-if="cell.blockType === 'RichTextBlock'">
58
+ <BlockText
59
+ variant="small"
60
+ :text="cell.value"
61
+ />
62
+ </template>
63
+ <template v-else-if="cell.blockType === 'ImageBlock'">
64
+ <BlockImageStandard
65
+ class=""
66
+ :data="cell.image"
67
+ :display-caption="cell.displayCaption"
68
+ :caption="cell.caption"
69
+ :constrain="cell.constrain"
70
+ />
71
+ </template>
72
+ </td>
73
+ </tr>
74
+ </tbody>
75
+ </table>
76
+ <template v-if="table.tableCaption">
77
+ <caption class="block text-left px-0 text-gray-mid-dark text-body-sm mt-4">
78
+ {{
79
+ table.tableCaption
80
+ }}
81
+ </caption>
82
+ </template>
83
+ </div>
84
+ </div>
85
+ </template>
86
+
87
+ <style lang="scss">
88
+ @import '@explorer-1/common/src/scss/components/BlockRichTable';
89
+ </style>
@@ -182,6 +182,15 @@
182
182
  <BlockTable :data="block" />
183
183
  </LayoutHelper>
184
184
 
185
+ <LayoutHelper
186
+ v-else-if="block.blockType == 'RichTableBlock'"
187
+ :key="`richTableBlock${index}`"
188
+ indent="col-3"
189
+ class="lg:mb-18 mb-10"
190
+ >
191
+ <BlockRichTable :table="block" />
192
+ </LayoutHelper>
193
+
185
194
  <LayoutHelper
186
195
  v-else-if="block.blockType == 'RelatedLinksBlock'"
187
196
  :key="`relatedLinksBlock${index}`"
@@ -269,6 +278,7 @@ import BlockRelatedLinks, {
269
278
  type BlockRelatedLinksObject
270
279
  } from './../BlockRelatedLinks/BlockRelatedLinks.vue'
271
280
  import BlockTable from './../BlockTable/BlockTable.vue'
281
+ import BlockRichTable from './../BlockRichTable/BlockRichTable.vue'
272
282
  import BlockTeaser from './../BlockTeaser/BlockTeaser.vue'
273
283
  import BlockText from './../BlockText/BlockText.vue'
274
284
  import BlockIframeEmbed from './../BlockIframeEmbed/BlockIframeEmbed.vue'
@@ -308,6 +318,7 @@ export default defineComponent({
308
318
  BlockQuote,
309
319
  BlockRelatedLinks,
310
320
  BlockTable,
321
+ BlockRichTable,
311
322
  BlockTeaser,
312
323
  BlockText,
313
324
  BlockIframeEmbed,
@@ -46,7 +46,7 @@
46
46
  :initial-slide="
47
47
  activeSeasonId === initialSeasonId && initialEpisodeIndex ? initialEpisodeIndex : 0
48
48
  "
49
- :slides="activeTabData.episodes"
49
+ :slides="activeTabData.episodes as Partial<Slide>[]"
50
50
  />
51
51
  </keep-alive>
52
52
  </div>
@@ -61,9 +61,10 @@ import ThumbnailCarousel from './../ThumbnailCarousel/ThumbnailCarousel.vue'
61
61
 
62
62
  const route = useRoute()
63
63
 
64
- interface ActiveTab {
64
+ interface Slide {
65
+ url: string
65
66
  title: string
66
- episodes: Episode[]
67
+ thumbnailImage: Partial<ImageObject>
67
68
  }
68
69
 
69
70
  interface Episode {
@@ -72,19 +73,25 @@ interface Episode {
72
73
  publicationDate: any
73
74
  thumbnailImage: Partial<ImageObject>
74
75
  }
76
+
77
+ interface ActiveTab {
78
+ title?: string
79
+ episodes?: Episode[] | Season
80
+ }
81
+
75
82
  interface Season {
76
83
  id: string
77
- url: string
78
- title: string
79
- seasonNumber: number
80
- episodes: Episode[]
84
+ url?: string
85
+ title?: string
86
+ seasonNumber?: number
87
+ episodes?: Episode[]
81
88
  }
82
89
 
83
90
  interface Series {
84
91
  id: string
85
- title: string
86
- url: string
87
- seasons: Season[]
92
+ title?: string
93
+ url?: string
94
+ seasons?: Season[]
88
95
  }
89
96
  export default defineComponent({
90
97
  name: 'PodcastSeriesCarousel',
@@ -111,11 +118,17 @@ export default defineComponent({
111
118
  }
112
119
  },
113
120
  computed: {
114
- sortedSeasons(): Season[] | null {
115
- let seasons = null
121
+ sortedSeasons(): Season[] | undefined {
122
+ let seasons = undefined
116
123
  if (this.series && this.series.seasons) {
117
124
  seasons = this.series.seasons
118
- return seasons.sort((a: Season, b: Season) => a.seasonNumber - b.seasonNumber)
125
+ // @ts-expect-error seasons is an array
126
+ seasons = seasons.toSorted((a: Season, b: Season) => {
127
+ if (a.seasonNumber && b.seasonNumber) {
128
+ return a.seasonNumber - b.seasonNumber
129
+ }
130
+ })
131
+ return seasons
119
132
  }
120
133
  return seasons
121
134
  },
@@ -142,9 +155,9 @@ export default defineComponent({
142
155
  }
143
156
  return null
144
157
  },
145
- activeTabData(): ActiveTab | undefined {
146
- let season: Season | undefined = undefined
147
- if (this.series?.seasons) {
158
+ activeTabData(): ActiveTab | Season | undefined {
159
+ let season
160
+ if (this.series?.seasons?.length) {
148
161
  if (this.activeSeasonId) {
149
162
  season = this.series.seasons.find((o: Season) => {
150
163
  return o.id === this.activeSeasonId
@@ -152,14 +165,21 @@ export default defineComponent({
152
165
  } else {
153
166
  season = this.series.seasons[0]
154
167
  }
155
- if (season?.episodes) {
156
- season.episodes.sort(
157
- (a: Episode, b: Episode) =>
158
- new Date(a.publicationDate).getTime() - new Date(b.publicationDate).getTime()
159
- )
168
+ if (season?.episodes?.length) {
169
+ let episodes: Episode[] = season.episodes
170
+ // @ts-expect-error episodes is an array
171
+ episodes = episodes.toSorted((a: Episode, b: Episode) => {
172
+ if (a.publicationDate && b.publicationDate) {
173
+ return new Date(a.publicationDate).getTime() - new Date(b.publicationDate).getTime()
174
+ }
175
+ })
176
+ season = {
177
+ ...season,
178
+ episodes: episodes
179
+ }
160
180
  }
161
181
  }
162
- return season ? season : undefined
182
+ return season
163
183
  }
164
184
  },
165
185
  methods: {
@@ -204,6 +204,7 @@
204
204
  </LayoutHelper>
205
205
 
206
206
  <PodcastSeriesCarousel
207
+ v-if="data?.series"
207
208
  :series="data.series"
208
209
  :initial-season-id="data.parent ? data.parent.id : null"
209
210
  class="mb-12 lg:mb-24"
@@ -215,9 +215,9 @@
215
215
  </LayoutHelper>
216
216
  <LayoutHelper
217
217
  v-if="
218
- (data.keepExploringMission && data.keepExploringMission.length) ||
219
- (data.keepExploringTarget && data.keepExploringTarget.length) ||
220
- (data.keepExploringInstrument && data.keepExploringInstrument.length)
218
+ data.keepExploringMission?.length ||
219
+ data.keepExploringTarget?.length ||
220
+ data.keepExploringInstrument?.length
221
221
  "
222
222
  indent="col-2"
223
223
  >
@@ -228,12 +228,7 @@
228
228
  </h2>
229
229
  <ul class="TopicTabs flex flex-row flex-wrap justify-start pb-4 mb-5 list-none">
230
230
  <li
231
- v-if="
232
- data.relatedMission &&
233
- data.relatedMission.length &&
234
- data.keepExploringMission &&
235
- data.keepExploringMission.length
236
- "
231
+ v-if="data.relatedMission?.length && data.keepExploringMission?.length"
237
232
  class="last:mr-0 sm:w-auto md:mr-16 w-full mr-10 text-center"
238
233
  >
239
234
  <button
@@ -247,12 +242,7 @@
247
242
  </button>
248
243
  </li>
249
244
  <li
250
- v-if="
251
- data.targets &&
252
- data.targets.length &&
253
- data.keepExploringTarget &&
254
- data.keepExploringTarget.length
255
- "
245
+ v-if="data.targets?.length && data.keepExploringTarget?.length"
256
246
  class="last:mr-0 sm:w-auto md:mr-16 w-full mr-10 text-center"
257
247
  >
258
248
  <button
@@ -265,12 +255,7 @@
265
255
  </button>
266
256
  </li>
267
257
  <li
268
- v-if="
269
- data.instruments &&
270
- data.instruments.length &&
271
- data.keepExploringInstrument &&
272
- data.keepExploringInstrument.length
273
- "
258
+ v-if="data.instruments?.length && data.keepExploringInstrument?.length"
274
259
  class="last:mr-0 sm:w-auto md:mr-16 w-full mr-10 text-center"
275
260
  >
276
261
  <button
@@ -285,9 +270,7 @@
285
270
  </ul>
286
271
  </LayoutHelper>
287
272
  <keep-alive>
288
- <template
289
- v-if="openTab === 1 && data.keepExploringMission && data.keepExploringMission.length"
290
- >
273
+ <template v-if="openTab === 1 && data.keepExploringMission?.length">
291
274
  <ThumbnailCarousel
292
275
  :key="openTab"
293
276
  class="lg:mb-24 mb-12"
@@ -295,9 +278,7 @@
295
278
  :slides="data.keepExploringMission"
296
279
  />
297
280
  </template>
298
- <template
299
- v-else-if="openTab === 2 && data.keepExploringTarget && data.keepExploringTarget.length"
300
- >
281
+ <template v-else-if="openTab === 2 && data.keepExploringTarget?.length">
301
282
  <ThumbnailCarousel
302
283
  :key="openTab"
303
284
  class="lg:mb-24 mb-12"
@@ -305,11 +286,7 @@
305
286
  :slides="data.keepExploringTarget"
306
287
  />
307
288
  </template>
308
- <template
309
- v-else-if="
310
- openTab === 3 && data.keepExploringInstrument && data.keepExploringInstrument.length
311
- "
312
- >
289
+ <template v-else-if="openTab === 3 && data.keepExploringInstrument?.length">
313
290
  <ThumbnailCarousel
314
291
  :key="openTab"
315
292
  class="lg:mb-24 mb-12"
@@ -319,7 +296,7 @@
319
296
  </template>
320
297
  </keep-alive>
321
298
  <div
322
- v-if="data.relatedTopics && data.relatedTopics.length"
299
+ v-if="data.relatedTopics?.length"
323
300
  class="bg-gray-light lg:py-24 py-12"
324
301
  >
325
302
  <BlockLinkCarousel
@@ -386,11 +363,11 @@ export default defineComponent({
386
363
  methods: {
387
364
  initExploreCarousels() {
388
365
  if (this.data) {
389
- if (this.data.keepExploringMission && this.data.keepExploringMission.length) {
366
+ if (this.data.keepExploringMission?.length) {
390
367
  this.openTab = 1
391
- } else if (this.data.keepExploringTarget && this.data.keepExploringTarget.length) {
368
+ } else if (this.data.keepExploringTarget?.length) {
392
369
  this.openTab = 2
393
- } else if (this.data.keepExploringInstrument && this.data.keepExploringInstrument.length) {
370
+ } else if (this.data.keepExploringInstrument?.length) {
394
371
  this.openTab = 3
395
372
  }
396
373
  }
@@ -207,10 +207,10 @@ export default defineComponent({
207
207
  return this.defaultShowGridView
208
208
  },
209
209
  sortedSeasons() {
210
- let seasons = null
210
+ let seasons = undefined
211
211
  if (this.data && this.data.seasons) {
212
212
  seasons = this.data.seasons
213
- return seasons.sort((a, b) => a.seasonNumber - b.seasonNumber)
213
+ seasons = seasons.toSorted((a, b) => a.seasonNumber - b.seasonNumber)
214
214
  }
215
215
  return seasons
216
216
  }
package/tsconfig.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "target": "ES2020",
4
4
  "useDefineForClassFields": true,
5
5
  "module": "ESNext",
6
- "lib": ["ES2021", "DOM", "DOM.Iterable"],
6
+ "lib": ["ES2021", "DOM", "DOM.Iterable", "ESNext.Array"],
7
7
  "skipLibCheck": true,
8
8
 
9
9
  /* Bundler mode */