@iqual/nuxt-icms 1.2.1 → 1.2.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 (39) hide show
  1. package/components/DesignSystem/Molecules/MediaLightbox.vue +273 -0
  2. package/components/DesignSystem/Molecules/MediaSlider.vue +19 -25
  3. package/components/DesignSystem/README.md +489 -0
  4. package/components/Media/RemoteVideo/index.vue +3 -3
  5. package/components/Node/Icms/Page/index.vue +5 -3
  6. package/components/Paragraph/Card/Layout/index.vue +2 -2
  7. package/components/Paragraph/Contact/index.vue +1 -2
  8. package/components/Paragraph/Downloads/index.vue +1 -2
  9. package/components/Paragraph/FAQ/Layout/index.vue +1 -2
  10. package/components/Paragraph/FlipTeasers/index.vue +2 -2
  11. package/components/Paragraph/Gallery/index.vue +16 -14
  12. package/components/Paragraph/IconText/Layout/index.vue +1 -2
  13. package/components/Paragraph/Table/index.vue +2 -2
  14. package/components/Paragraph/Team/Layout/index.vue +2 -2
  15. package/components/Paragraph/Teasers/index.vue +3 -3
  16. package/components/Paragraph/Timeline/Layout/index.vue +6 -3
  17. package/components/Paragraph/iFrame/index.vue +16 -2
  18. package/components/Section/Footer/index.vue +15 -14
  19. package/components/Section/Header/GlobalMenu.vue +34 -34
  20. package/components/Section/Header/MetaMenu.vue +17 -19
  21. package/components/Section/Header/index.vue +21 -22
  22. package/composables/useGlobalConfig.ts +57 -0
  23. package/composables/useGraphqlCacheability.ts +22 -0
  24. package/composables/useInitData.ts +20 -112
  25. package/composables/useMediaLightbox.ts +114 -0
  26. package/composables/useMenu.ts +66 -0
  27. package/modules/dynamicEntityComponentResolver.ts +0 -20
  28. package/nuxt.config.ts +0 -5
  29. package/package.json +1 -2
  30. package/plugins/graphqlMiddleware.ts +27 -68
  31. package/plugins/initData.ts +105 -0
  32. package/{composables → queries}/query.initData.graphql +2 -8
  33. package/queries/query.loadTranslations.graphql +5 -0
  34. package/types/initData.ts +1 -0
  35. package/components/Section/Header/SearchLink.vue +0 -26
  36. package/composables/useLightbox.ts +0 -81
  37. package/composables/useMainMenuLinks.ts +0 -69
  38. package/composables/useMetaMenuLinks.ts +0 -44
  39. package/types/fslightbox-vue.d.ts +0 -1
@@ -1,81 +0,0 @@
1
- import type { MediaFragment } from '#graphql-operations'
2
- import { DesignSystemAtomsCaption } from '#components'
3
-
4
- export function useLightbox(media: (MediaFragment | null)[] | undefined) {
5
- const toggleLightbox = ref(false)
6
- const currentSlide = ref(1)
7
-
8
- const openLightbox = (index: number) => {
9
- currentSlide.value = index + 1 // fsLightbox uses 1-based indexing
10
- toggleLightbox.value = !toggleLightbox.value
11
- }
12
-
13
- // https://fslightbox.com/vue/documentation/sources
14
- const computedMedia = computed(() =>
15
- media?.map(item => {
16
- if (!item) return ''
17
- switch (item.type) {
18
- case 'MediaImage':
19
- return item.sourceUrl?.path || ''
20
- case 'MediaVideo':
21
- return item.url?.path || ''
22
- case 'MediaRemoteVideo':
23
- return item.link || ''
24
- default:
25
- return ''
26
- }
27
- }).filter(Boolean) || []
28
- )
29
-
30
- // https://fslightbox.com/vue/documentation/custom-attributes
31
- const computedCustomAttributes = computed(() =>
32
- media?.map(item => {
33
- if (!item) return {}
34
-
35
- switch (item.type) {
36
- case 'MediaImage':
37
- return {
38
- alt: item.alt?.alt || '',
39
- title: item.title || ''
40
- }
41
-
42
- case 'MediaVideo':
43
- return {
44
- alt: (item.thumbnailOverride || item.thumbnail)?.alt || '',
45
- title: item.title || '',
46
- poster: (item.thumbnailOverride || item.thumbnail)?.entity?.uri?.first?.url || '',
47
- controls: true
48
- }
49
-
50
- case 'MediaRemoteVideo':
51
- return {
52
- alt: (item.thumbnailOverride || item.thumbnail)?.alt || '',
53
- title: item.title || '',
54
- poster: (item.thumbnailOverride || item.thumbnail)?.entity?.uri?.first?.url || ''
55
- }
56
-
57
- default:
58
- return {}
59
- }
60
- }) || []
61
- )
62
-
63
- // https://fslightbox.com/vue/documentation/captions
64
- const computedCaptions = computed(() =>
65
- media?.map(item => ({
66
- component: DesignSystemAtomsCaption,
67
- props: {
68
- caption: item?.caption || ''
69
- }
70
- })) || []
71
- )
72
-
73
- return {
74
- toggleLightbox,
75
- currentSlide,
76
- openLightbox,
77
- sources: computedMedia,
78
- customAttributes: computedCustomAttributes,
79
- captions: computedCaptions
80
- }
81
- }
@@ -1,69 +0,0 @@
1
- import type { InitData } from './useInitData'
2
- import type { MenuLinkTreeFragment } from '#graphql-operations'
3
-
4
- function isLinkTreeActive(
5
- tree: MenuLinkTreeFragment & { subtree?: Array<MenuLinkTreeFragment> },
6
- currentRoutePath: string,
7
- ): boolean {
8
- if (tree.link.url?.path === currentRoutePath) {
9
- return true
10
- }
11
-
12
- if (tree.subtree) {
13
- return tree.subtree.some((subtreeEl) =>
14
- isLinkTreeActive(subtreeEl, currentRoutePath),
15
- )
16
- }
17
-
18
- return false
19
- }
20
-
21
- export async function useMainMenuLinks() {
22
- const initData: Ref<InitData> = await useInitData()
23
- const currentRoute = useRoute()
24
-
25
- const links = computed(() => {
26
- return initData.value.mainMenuLinks
27
- })
28
-
29
- const currentActiveMainLink = computed(() => {
30
- return initData.value.mainMenuLinks.find((l) =>
31
- isLinkTreeActive(l, currentRoute.path),
32
- )
33
- })
34
-
35
- const activeFirstLevelLink = computed(() => {
36
- return currentActiveMainLink.value?.subtree.find((l) =>
37
- isLinkTreeActive(l, currentRoute.path),
38
- )
39
- })
40
-
41
- const activeSecondLevelLink = computed(() => {
42
- const activeSubtree = activeFirstLevelLink.value?.subtree
43
- if (activeSubtree) {
44
- return activeSubtree.find((l) => isLinkTreeActive(l, currentRoute.path))
45
- }
46
- return null
47
- })
48
-
49
- const activeThirdLevelLink = computed(() => {
50
- const activeSubtree = activeSecondLevelLink.value?.subtree
51
- if (activeSubtree) {
52
- return activeSubtree.find((l) => isLinkTreeActive(l, currentRoute.path))
53
- }
54
- return null
55
- })
56
-
57
- const isHotelActive = computed(() => {
58
- return isLinkTreeActive(initData.value.mainMenuLinks[2], currentRoute.path)
59
- })
60
-
61
- return {
62
- links,
63
- currentActiveMainLink,
64
- activeFirstLevelLink,
65
- activeSecondLevelLink,
66
- activeThirdLevelLink,
67
- isHotelActive,
68
- }
69
- }
@@ -1,44 +0,0 @@
1
- import type { InitData } from './useInitData'
2
- import type { MenuLinkTreeFragment } from '#graphql-operations'
3
-
4
- function isLinkTreeActive(
5
- tree: MenuLinkTreeFragment & { subtree?: Array<MenuLinkTreeFragment> },
6
- currentRoutePath: string,
7
- ): boolean {
8
- if (tree.link.url?.path === currentRoutePath) {
9
- return true
10
- }
11
-
12
- if (tree.subtree) {
13
- return tree.subtree.some((subtreeEl) =>
14
- isLinkTreeActive(subtreeEl, currentRoutePath),
15
- )
16
- }
17
-
18
- return false
19
- }
20
-
21
- export async function useMetaMenuLinks() {
22
- const initData: Ref<InitData> = await useInitData()
23
- const currentRoute = useRoute()
24
-
25
- const links = computed(() => {
26
- return initData.value.metaMenuLinks
27
- })
28
-
29
- const currentActiveMetaLink = computed(() => {
30
- return initData.value.metaMenuLinks.find((l) =>
31
- isLinkTreeActive(l, currentRoute.path),
32
- )
33
- })
34
-
35
- const isHotelActive = computed(() => {
36
- return isLinkTreeActive(initData.value.metaMenuLinks[2], currentRoute.path)
37
- })
38
-
39
- return {
40
- links,
41
- currentActiveMetaLink,
42
- isHotelActive,
43
- }
44
- }
@@ -1 +0,0 @@
1
- declare module 'fslightbox-vue'