@asd20/ui-next 2.33.2 → 2.33.3

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 (22) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.json +1 -1
  3. package/src/components/atoms/Asd20RichBodyContent/index.vue +3 -2
  4. package/src/components/organisms/Asd20MediaSection/index.vue +26 -5
  5. package/src/components/templates/Asd20ArticleDigestCompactTemplate/index.vue +1 -0
  6. package/src/components/templates/Asd20ArticleDigestTemplate/index.vue +1 -0
  7. package/src/components/templates/Asd20ArticleListTemplate/index.vue +1 -0
  8. package/src/components/templates/Asd20ArticleTemplate/index.vue +3 -2
  9. package/src/components/templates/Asd20CampusDetailTemplate/index.vue +1 -0
  10. package/src/components/templates/Asd20ClubsTemplate/index.vue +1 -0
  11. package/src/components/templates/Asd20DetailAlternateTemplate/index.vue +1 -0
  12. package/src/components/templates/Asd20DetailImageFullTemplate/index.vue +1 -0
  13. package/src/components/templates/Asd20DetailImageTemplate/index.vue +1 -0
  14. package/src/components/templates/Asd20DetailTemplate/index.vue +1 -0
  15. package/src/components/templates/Asd20FileListPageTemplate/index.vue +1 -0
  16. package/src/components/templates/Asd20GroupFeatureTemplate/index.vue +1 -0
  17. package/src/components/templates/Asd20ProfileTemplate/index.vue +1 -0
  18. package/src/components/templates/Asd20WayfindingAlternateTemplate/index.vue +1 -0
  19. package/src/components/templates/Asd20WayfindingImageTemplate/index.vue +1 -0
  20. package/src/components/templates/Asd20WayfindingTemplate/index.vue +1 -0
  21. package/src/helpers/excludeBodyMedia.js +96 -0
  22. package/src/mixins/pageTemplateMixin.js +0 -44
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.33.3](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.33.2...ui-next-v2.33.3) (2026-10-27)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * limit size of videos in body content; exclude videos and images already in body content from media section ([aba90ce](https://github.com/academydistrict20/asd20-ui-next/commit/aba90ceec4c244a8317cc544972fa753615da982))
9
+
3
10
  ## [2.33.2](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.33.1...ui-next-v2.33.2) (2026-10-26)
4
11
 
5
12
  ## [2.33.1](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.33.0...ui-next-v2.33.1) (2026-10-26)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asd20/ui-next",
3
- "version": "2.33.2",
3
+ "version": "2.33.3",
4
4
  "private": false,
5
5
  "description": "ASD20 UI component library for Vue 3.",
6
6
  "license": "MIT",
@@ -231,8 +231,9 @@ export default {
231
231
  }
232
232
 
233
233
  :deep(.asd20-message-video) {
234
- max-width: 100%;
235
- margin: 0.75rem 0;
234
+ width: 100%;
235
+ max-width: 1200px;
236
+ margin: 0.75rem auto;
236
237
  }
237
238
 
238
239
  :deep(.asd20-message-video__description) {
@@ -1,22 +1,22 @@
1
1
  <template>
2
2
  <section
3
- v-show="images.length || videos.length"
3
+ v-if="showImageGallery || remainingMedia.videos.length"
4
4
  class="asd20-media-section"
5
5
  role="complementary"
6
6
  >
7
7
  <slot name="before" />
8
8
 
9
9
  <asd20-image-gallery
10
- v-if="allowSingleImageGallery ? images.length > 0 : images.length > 1"
10
+ v-if="showImageGallery"
11
11
  title="Images"
12
- :images="images"
12
+ :images="galleryImages"
13
13
  >
14
14
  </asd20-image-gallery>
15
15
 
16
16
  <asd20-videos-section
17
- v-if="videos.length > 0"
17
+ v-if="remainingMedia.videos.length > 0"
18
18
  title="Videos"
19
- :videos="videos"
19
+ :videos="remainingMedia.videos"
20
20
  >
21
21
  </asd20-videos-section>
22
22
  <slot />
@@ -25,6 +25,7 @@
25
25
 
26
26
  <script>
27
27
  import { defineAsyncComponent } from 'vue'
28
+ import excludeBodyMedia from '../../../helpers/excludeBodyMedia'
28
29
 
29
30
  export default {
30
31
  name: 'Asd20MediaSection',
@@ -40,6 +41,26 @@ export default {
40
41
  allowSingleImageGallery: { type: Boolean, default: false },
41
42
  images: { type: Array, default: () => [] },
42
43
  videos: { type: Array, default: () => [] },
44
+ // Include only messages whose bodies are displayed on this page.
45
+ bodyMessages: { type: Array, default: () => [] },
46
+ },
47
+ computed: {
48
+ remainingMedia() {
49
+ return excludeBodyMedia({
50
+ images: this.images,
51
+ videos: this.videos,
52
+ bodyMessages: this.bodyMessages,
53
+ })
54
+ },
55
+ galleryImages() {
56
+ return this.remainingMedia.images.filter(image => !image.isCover)
57
+ },
58
+ showImageGallery() {
59
+ // Preserve galleries that have one image left after body duplicates
60
+ // are removed, while retaining the existing single-image opt-in.
61
+ return this.galleryImages.length > 0 &&
62
+ (this.allowSingleImageGallery || this.images.length > 1)
63
+ },
43
64
  },
44
65
  }
45
66
  </script>
@@ -210,6 +210,7 @@
210
210
 
211
211
  <asd20-media-section
212
212
  v-if="combinedMessageImages.length > 1 || combinedMessageVideos.length"
213
+ :body-messages="[...primaryMessages, ...secondaryMessages]"
213
214
  :images="combinedMessageImages || []"
214
215
  :videos="combinedMessageVideos || []"
215
216
  >
@@ -211,6 +211,7 @@
211
211
 
212
212
  <asd20-media-section
213
213
  v-if="combinedMessageImages.length > 1 || combinedMessageVideos.length"
214
+ :body-messages="[...primaryMessages, ...secondaryMessages]"
214
215
  :images="combinedMessageImages || []"
215
216
  :videos="combinedMessageVideos || []"
216
217
  >
@@ -230,6 +230,7 @@
230
230
 
231
231
  <asd20-media-section
232
232
  v-if="combinedMessageImages.length > 1 || combinedMessageVideos.length"
233
+ :body-messages="[...primaryMessages, ...secondaryMessages]"
233
234
  :images="combinedMessageImages || []"
234
235
  :videos="combinedMessageVideos || []"
235
236
  >
@@ -95,9 +95,10 @@
95
95
  ></asd20-feeds-section> -->
96
96
 
97
97
  <asd20-media-section
98
- v-if="shouldShowArticleMediaSection"
98
+ v-if="combinedMessageImages.length || combinedMessageVideos.length"
99
+ :body-messages="[...primaryDetailMessages, ...secondaryMessages]"
99
100
  allow-single-image-gallery
100
- :images="articleGalleryImages || []"
101
+ :images="combinedMessageImages || []"
101
102
  :videos="combinedMessageVideos || []"
102
103
  >
103
104
  </asd20-media-section>
@@ -89,6 +89,7 @@
89
89
 
90
90
  <asd20-media-section
91
91
  v-if="combinedMessageImages.length > 1 || combinedMessageVideos.length"
92
+ :body-messages="[...primaryMessages, ...secondaryMessages]"
92
93
  :images="combinedMessageImages || []"
93
94
  :videos="combinedMessageVideos || []"
94
95
  >
@@ -222,6 +222,7 @@
222
222
 
223
223
  <asd20-media-section
224
224
  v-if="combinedMessageImages.length > 1 || combinedMessageVideos.length"
225
+ :body-messages="[...primaryMessages, ...secondaryMessages]"
225
226
  :images="combinedMessageImages || []"
226
227
  :videos="combinedMessageVideos || []"
227
228
  >
@@ -95,6 +95,7 @@
95
95
 
96
96
  <asd20-media-section
97
97
  v-if="combinedMessageImages.length > 1 || combinedMessageVideos.length"
98
+ :body-messages="[...primaryDetailMessages, ...secondaryMessages]"
98
99
  :images="combinedMessageImages || []"
99
100
  :videos="combinedMessageVideos || []"
100
101
  >
@@ -94,6 +94,7 @@
94
94
 
95
95
  <asd20-media-section
96
96
  v-if="combinedMessageImages.length > 1 || combinedMessageVideos.length"
97
+ :body-messages="[...primaryDetailMessages, ...secondaryMessages]"
97
98
  :images="combinedMessageImages || []"
98
99
  :videos="combinedMessageVideos || []"
99
100
  >
@@ -94,6 +94,7 @@
94
94
 
95
95
  <asd20-media-section
96
96
  v-if="combinedMessageImages.length > 1 || combinedMessageVideos.length"
97
+ :body-messages="[...primaryDetailMessages, ...secondaryMessages]"
97
98
  :images="combinedMessageImages || []"
98
99
  :videos="combinedMessageVideos || []"
99
100
  >
@@ -94,6 +94,7 @@
94
94
 
95
95
  <asd20-media-section
96
96
  v-if="combinedMessageImages.length > 1 || combinedMessageVideos.length"
97
+ :body-messages="[...primaryDetailMessages, ...secondaryMessages]"
97
98
  :images="combinedMessageImages || []"
98
99
  :videos="combinedMessageVideos || []"
99
100
  >
@@ -90,6 +90,7 @@
90
90
 
91
91
  <asd20-media-section
92
92
  v-if="combinedMessageImages.length > 1 || combinedMessageVideos.length"
93
+ :body-messages="[...primaryMessages, ...secondaryMessages]"
93
94
  :images="combinedMessageImages || []"
94
95
  :videos="combinedMessageVideos || []"
95
96
  >
@@ -91,6 +91,7 @@
91
91
 
92
92
  <asd20-media-section
93
93
  v-if="combinedMessageImages.length > 1 || combinedMessageVideos.length"
94
+ :body-messages="[...primaryMessagesGroup, ...secondaryMessages]"
94
95
  :images="combinedMessageImages || []"
95
96
  :videos="combinedMessageVideos || []"
96
97
  >
@@ -276,6 +276,7 @@
276
276
 
277
277
  <asd20-media-section
278
278
  v-if="combinedMessageImages.length > 1 || combinedMessageVideos.length"
279
+ :body-messages="[...primaryMessages, ...secondaryMessages]"
279
280
  :images="combinedMessageImages || []"
280
281
  :videos="combinedMessageVideos || []"
281
282
  >
@@ -95,6 +95,7 @@
95
95
  <!-- Photos & Videos -->
96
96
  <asd20-media-section
97
97
  v-if="firstMessage.images.length > 1 || firstMessage.videos.length"
98
+ :body-messages="primaryMessage || []"
98
99
  :images="firstMessage.images || []"
99
100
  :videos="firstMessage.videos || []"
100
101
  >
@@ -96,6 +96,7 @@
96
96
  <!-- Photos & Videos -->
97
97
  <asd20-media-section
98
98
  v-if="firstMessage.images.length > 1 || firstMessage.videos.length"
99
+ :body-messages="primaryMessage || []"
99
100
  :images="firstMessage.images || []"
100
101
  :videos="firstMessage.videos || []"
101
102
  >
@@ -93,6 +93,7 @@
93
93
  <!-- Photos & Videos -->
94
94
  <asd20-media-section
95
95
  v-if="firstMessage.images.length > 1 || firstMessage.videos.length"
96
+ :body-messages="primaryMessage || []"
96
97
  :images="firstMessage.images || []"
97
98
  :videos="firstMessage.videos || []"
98
99
  >
@@ -0,0 +1,96 @@
1
+ import { parseFragment } from 'parse5'
2
+ import { buildRichBodyRenderModel } from '../components/atoms/Asd20RichBodyContent/messageDocumentRenderer'
3
+
4
+ const STORAGE_HOST = 'asd20websitestorage.blob.core.windows.net'
5
+ const RELATIVE_ORIGIN = 'https://ui-next.invalid'
6
+
7
+ function resourceKey(value) {
8
+ if (typeof value !== 'string' || !value.trim()) return ''
9
+ try {
10
+ const url = new URL(value.trim(), RELATIVE_ORIGIN)
11
+ if (!['http:', 'https:'].includes(url.protocol)) return ''
12
+ url.hash = ''
13
+ // The website media proxy and blob origin serve the same stored files.
14
+ if (url.pathname.startsWith('/_media/')) {
15
+ return `storage:${url.pathname.slice('/_media'.length)}${url.search}`
16
+ }
17
+ if (url.hostname === STORAGE_HOST) {
18
+ return `storage:${url.pathname}${url.search}`
19
+ }
20
+ return url.href
21
+ } catch {
22
+ return ''
23
+ }
24
+ }
25
+
26
+ function videoKey(value) {
27
+ const key = resourceKey(value)
28
+ if (!key || key.startsWith('storage:')) return key
29
+ const url = new URL(key)
30
+ const host = url.hostname.replace(/^www\./, '')
31
+ if (['youtube.com', 'youtube-nocookie.com', 'youtu.be'].includes(host)) {
32
+ const id = host === 'youtu.be'
33
+ ? url.pathname.split('/')[1]
34
+ : url.searchParams.get('v') || url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/)?.[1]
35
+ if (id) return `youtube:${id}`
36
+ }
37
+ if (['vimeo.com', 'player.vimeo.com'].includes(host)) {
38
+ const id = url.pathname.match(/^\/(?:video\/)?(\d+)(?:\/|$)/)?.[1]
39
+ if (id) return `vimeo:${id}`
40
+ }
41
+ if (host === 'live.myvrspot.com' && url.searchParams.get('v')) {
42
+ return `myvrspot:${url.searchParams.get('v')}`
43
+ }
44
+ return key
45
+ }
46
+
47
+ function addSource(sources, value, normalize) {
48
+ const key = normalize(value)
49
+ if (key) sources.add(key)
50
+ }
51
+
52
+ function collectHtmlMedia(html, sources) {
53
+ const visit = node => {
54
+ const attrs = Object.fromEntries((node.attrs || []).map(attr => [attr.name, attr.value]))
55
+ if (node.tagName === 'img') {
56
+ addSource(sources.images, attrs.src, resourceKey)
57
+ }
58
+ if (['iframe', 'video'].includes(node.tagName) ||
59
+ (node.tagName === 'source' && node.parentNode?.tagName === 'video')) {
60
+ addSource(sources.videos, attrs.src, videoKey)
61
+ }
62
+ for (const child of node.childNodes || []) visit(child)
63
+ }
64
+ visit(parseFragment(html || ''))
65
+ }
66
+
67
+ export default function excludeBodyMedia({ images = [], videos = [], bodyMessages = [] } = {}) {
68
+ const sources = { images: new Set(), videos: new Set() }
69
+ for (const message of bodyMessages) {
70
+ if (!message) continue
71
+ // Use the renderer's selected content, including its HTML fallback for
72
+ // invalid/unsupported JSON, rather than inspecting stale saved sidecars.
73
+ const model = buildRichBodyRenderModel({
74
+ bodyContent: message.bodyContent || message.bodyHtml || '',
75
+ bodyJson: message.bodyJson,
76
+ })
77
+ for (const node of model.nodes) {
78
+ if (node.html) collectHtmlMedia(node.html, sources)
79
+ if (node.type === 'accordion') {
80
+ for (const item of node.block.items || []) {
81
+ if (item.contentType !== 'tableau') collectHtmlMedia(item.bodyHtml, sources)
82
+ }
83
+ }
84
+ }
85
+ }
86
+
87
+ return {
88
+ images: images.filter(image => image && ![
89
+ image.url,
90
+ ...(image.files || []).map(file => file?.url),
91
+ ].some(url => sources.images.has(resourceKey(url)))),
92
+ videos: videos.filter(video => video && ![
93
+ video.embedUrl, video.watchUrl, video.url,
94
+ ].some(url => sources.videos.has(videoKey(url)))),
95
+ }
96
+ }
@@ -1,32 +1,6 @@
1
1
  import responsiveBreakpointMixin from './responsiveBreakpointMixin'
2
2
  import { buildBreadcrumbLinks } from '../helpers/breadcrumbLinks'
3
3
 
4
- function getMessageBodyHtml(message) {
5
- return (message && (message.bodyContent || message.bodyHtml)) || ''
6
- }
7
-
8
- function getImageUrls(image) {
9
- const urls = []
10
- const files = (image && image.files) || []
11
- if (image && image.url) urls.push(image.url)
12
- files.forEach(file => {
13
- if (file && file.url) urls.push(file.url)
14
- })
15
- return urls
16
- }
17
-
18
- function normalizeHtmlValue(value) {
19
- return String(value || '').replace(/&amp;/g, '&')
20
- }
21
-
22
- function imageAppearsInBody(image, bodyHtml) {
23
- if (!bodyHtml) return false
24
- const normalizedBodyHtml = normalizeHtmlValue(bodyHtml)
25
- return getImageUrls(image).some(url =>
26
- normalizedBodyHtml.includes(normalizeHtmlValue(url))
27
- )
28
- }
29
-
30
4
  export default {
31
5
  mixins: [responsiveBreakpointMixin],
32
6
 
@@ -270,24 +244,6 @@ export default {
270
244
  }, [])
271
245
  },
272
246
 
273
- articleGalleryImages() {
274
- const messageBodies = (this.primaryDetailMessages || [])
275
- .map(getMessageBodyHtml)
276
- .filter(Boolean)
277
-
278
- return this.combinedMessageImages.filter(image => {
279
- if (!image || image.isCover) return false
280
- return !messageBodies.some(bodyHtml => imageAppearsInBody(image, bodyHtml))
281
- })
282
- },
283
-
284
- shouldShowArticleMediaSection() {
285
- return (
286
- this.articleGalleryImages.length > 0 ||
287
- this.combinedMessageVideos.length > 0
288
- )
289
- },
290
-
291
247
  combinedMessageVideos() {
292
248
  return (this.messages || []).reduce((a, m) => {
293
249
  const videos = m.videos || []