@iqual/nuxt-icms 1.0.13 → 1.1.0

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 (40) hide show
  1. package/components/Blokkli/Timeline/Element/icms_timeline_element.svg +7 -0
  2. package/components/Blokkli/Timeline/Element/icon.svg +7 -0
  3. package/components/Blokkli/Timeline/Element/index.vue +14 -0
  4. package/components/Blokkli/Timeline/Layout/icms_layout_timeline.svg +16 -0
  5. package/components/Blokkli/Timeline/Layout/icon.svg +16 -0
  6. package/components/Blokkli/Timeline/Layout/index.vue +14 -0
  7. package/components/Blokkli/iFrame/icon-blokkli-option-large-spacing-bottom.svg +1 -0
  8. package/components/Blokkli/iFrame/icon-blokkli-option-large-spacing-top.svg +1 -0
  9. package/components/Blokkli/iFrame/icon-blokkli-option-no-spacing.svg +1 -0
  10. package/components/Blokkli/iFrame/icon-blokkli-option-small-spacing-bottom.svg +1 -0
  11. package/components/Blokkli/iFrame/icon-blokkli-option-small-spacing-top.svg +1 -0
  12. package/components/Blokkli/iFrame/{Layout/index.vue → index.vue} +2 -6
  13. package/components/DesignSystem/Organisms/TimelineElement.vue +92 -0
  14. package/components/Media/Image/index.vue +1 -1
  15. package/components/Media/RemoteVideo/index.vue +18 -11
  16. package/components/Media/Video/index.vue +6 -4
  17. package/components/Paragraph/Media/index.vue +13 -8
  18. package/components/Paragraph/Timeline/Element/fragment.graphql +16 -0
  19. package/components/Paragraph/Timeline/Element/index.vue +31 -0
  20. package/components/Paragraph/Timeline/Layout/fragment.graphql +14 -0
  21. package/components/Paragraph/Timeline/Layout/index.vue +325 -0
  22. package/components/Paragraph/iFrame/{Layout/fragment.graphql → fragment.graphql} +2 -6
  23. package/components/Paragraph/iFrame/index.vue +56 -0
  24. package/nuxt.config.ts +17 -10
  25. package/package.json +1 -1
  26. package/server/graphqlMiddleware.serverOptions.ts +3 -3
  27. package/tests/pages.spec.ts +101 -0
  28. package/vitest.config.mts +2 -2
  29. package/components/Blokkli/iFrame/Element/icon.svg +0 -5
  30. package/components/Blokkli/iFrame/Element/index.vue +0 -14
  31. package/components/Paragraph/iFrame/Element/fragment.graphql +0 -9
  32. package/components/Paragraph/iFrame/Element/index.vue +0 -16
  33. package/components/Paragraph/iFrame/Layout/index.vue +0 -161
  34. package/pages/__tests__/index.ts +0 -77
  35. /package/components/Blokkli/{iFrame → Timeline}/Layout/icon-blokkli-option-large-spacing-bottom.svg +0 -0
  36. /package/components/Blokkli/{iFrame → Timeline}/Layout/icon-blokkli-option-large-spacing-top.svg +0 -0
  37. /package/components/Blokkli/{iFrame → Timeline}/Layout/icon-blokkli-option-no-spacing.svg +0 -0
  38. /package/components/Blokkli/{iFrame → Timeline}/Layout/icon-blokkli-option-small-spacing-bottom.svg +0 -0
  39. /package/components/Blokkli/{iFrame → Timeline}/Layout/icon-blokkli-option-small-spacing-top.svg +0 -0
  40. /package/components/Blokkli/iFrame/{Layout/icon.svg → icon.svg} +0 -0
@@ -1,161 +0,0 @@
1
- <template>
2
- <DesignSystemAtomsContainer :colorScheme="colorScheme" :spacing="spacing">
3
- <DesignSystemAtomsGridRow class="pb-14 md:pb-0">
4
- <div class="col-span-12 md:col-span-6" v-if="title">
5
- <DesignSystemOrganismsContentBlock
6
- :pretitle="pretitle"
7
- :title="title"
8
- :titleWeight="titleWeight"
9
- :text="text"
10
- :colorScheme="colorScheme"
11
- />
12
- </div>
13
-
14
- <div v-if="isEditing" class="col-span-12">
15
- <BlokkliField
16
- name="field_icms_iframe_elements"
17
- :list="iFrameElements"
18
- :class="{ droptarget: isEditing }"
19
- />
20
- </div>
21
-
22
- <div v-else class="col-span-12">
23
- <template v-if="iFrameElements && iFrameElements.length === 1">
24
- <DesignSystemMoleculesIFrame
25
- :title="iFrameElements[0].props?.title"
26
- :link="iFrameElements[0].props?.link?.uri?.path"
27
- :height="iFrameElements[0].props?.height"
28
- />
29
- </template>
30
-
31
- <Tabs
32
- v-if="!isMobile && iFrameElements && iFrameElements.length > 1"
33
- default-value="tab-1"
34
- class="rounded-lg shadow-custom"
35
- >
36
- <TabsList
37
- class="flex flex-col items-center justify-center bg-transparent p-0 lg:flex-row dark:bg-transparent"
38
- >
39
- <TabsTrigger
40
- v-for="(iFrameElement, key) in iFrameElements"
41
- :key="key"
42
- :value="`tab-${key + 1}`"
43
- :class="tabTrigger({ colorScheme })"
44
- >
45
- {{ iFrameElement?.props?.title }}
46
- </TabsTrigger>
47
- </TabsList>
48
- <TabsContent
49
- forceMount
50
- v-for="(iFrameElement, key) in iFrameElements"
51
- :key="key"
52
- :value="`tab-${key + 1}`"
53
- :class="tabContent({ colorScheme })"
54
- >
55
- <DesignSystemMoleculesIFrame
56
- :title="iFrameElement.props?.title"
57
- :link="iFrameElement.props?.link?.uri?.path"
58
- :height="iFrameElement.props?.height"
59
- />
60
- </TabsContent>
61
- </Tabs>
62
-
63
- <Accordion
64
- v-if="isMobile && iFrameElements && iFrameElements.length > 1"
65
- type="single"
66
- class="w-full"
67
- collapsible
68
- default-value="accordion-1"
69
- >
70
- <AccordionItem
71
- v-for="(iFrameElement, key) in iFrameElements"
72
- :key="key"
73
- :value="`accordion-${key + 1}`"
74
- class="mb-1 border-none [&>h3]:mb-0"
75
- >
76
- <AccordionTrigger
77
- :ref="(el: any) => (triggerRefs[key] = el)"
78
- :class="accordionTrigger({ colorScheme })"
79
- @click="handleClick(key)"
80
- >
81
- {{ iFrameElement?.props?.title }}
82
- </AccordionTrigger>
83
- <AccordionContent class="p-4 pb-6 text-base">
84
- <DesignSystemMoleculesIFrame
85
- :title="iFrameElement.props?.title"
86
- :link="iFrameElement.props?.link?.uri?.path"
87
- :height="iFrameElement.props?.height"
88
- />
89
- </AccordionContent>
90
- </AccordionItem>
91
- </Accordion>
92
- </div>
93
- </DesignSystemAtomsGridRow>
94
- </DesignSystemAtomsContainer>
95
- </template>
96
-
97
- <script lang="ts" setup>
98
- import type { ParagraphIcmsLayoutIframeFragment } from '#graphql-operations'
99
- import { tv } from 'tailwind-variants'
100
-
101
- defineProps<ParagraphIcmsLayoutIframeFragment>()
102
-
103
- const { isMobile } = useIsMobile()
104
-
105
- const { options, isEditing } = useAttrs().blokkliData
106
-
107
- const tabTrigger = tv({
108
- base: 'inline-flex w-full flex-1 items-center justify-center whitespace-nowrap rounded-none rounded-t-lg py-4 text-base shadow-custom-inner transition-all disabled:pointer-events-none lg:w-fit data-[state=active]:shadow-none',
109
- variants: {
110
- colorScheme: {
111
- none: 'bg-white dark:bg-white text-black dark:text-black data-[state=active]:bg-white dark:data-[state=active]:bg-white dark:data-[state=active]:text-black',
112
- dark: 'bg-gray-700 dark:bg-gray-700 text-white dark:text-white data-[state=active]:bg-gray-900 dark:data-[state=active]:bg-gray-900 data-[state=active]:text-white',
113
- light:
114
- 'bg-white dark:bg-white text-black dark:text-black data-[state=active]:bg-white dark:data-[state=active]:bg-white dark:data-[state=active]:text-black',
115
- accent:
116
- 'bg-primary-600 dark:bg-primary-600 text-white dark:text-white data-[state=active]:bg-primary-700 dark:data-[state=active]:bg-primary-700 data-[state=active]:text-white',
117
- },
118
- },
119
- })
120
-
121
- const tabContent = tv({
122
- base: 'm-0 rounded-b-lg p-8 text-black md:p-16',
123
- variants: {
124
- colorScheme: {
125
- none: 'bg-white text-black',
126
- dark: 'bg-gray-900 text-white',
127
- light: 'bg-white text-black',
128
- accent: 'bg-primary-700 text-white',
129
- },
130
- },
131
- })
132
-
133
- const accordionTrigger = tv({
134
- base: 'items-center rounded-lg px-6 py-4 shadow-custom-small hover:no-underline gap-4 text-left text-base',
135
- variants: {
136
- colorScheme: {
137
- none: 'bg-white text-black',
138
- dark: 'bg-gray-900 text-white',
139
- light: 'bg-white text-black',
140
- accent: 'bg-primary-700 text-white',
141
- },
142
- },
143
- })
144
-
145
- const triggerRefs = ref<Array<ComponentPublicInstance>>([])
146
-
147
- const handleClick = (index: number): void => {
148
- const { handleAccordionOpen } = useAccordionScroll(triggerRefs.value[index])
149
- handleAccordionOpen()
150
- }
151
-
152
- const colorScheme = computed(() => {
153
- return options.value.colorScheme
154
- })
155
-
156
- const spacing = computed(() => {
157
- return { bottom: options.value.spacingBottom, top: options.value.spacingTop }
158
- })
159
-
160
- provide('isEditing', isEditing)
161
- </script>
@@ -1,77 +0,0 @@
1
- import path from 'path'
2
- import { promises as fsp } from 'fs'
3
- import { describe, it, expect } from 'vitest'
4
- import { glob } from 'glob'
5
- import * as ts from 'typescript'
6
- import { parse as parseSfc } from '@vue/compiler-sfc'
7
-
8
- // Parse a Vue SFC and check if the component's script calls the given function at least once.
9
- function functionIsCalledAtLeastOnce(
10
- vueFileContents: string,
11
- functionName: string,
12
- ): boolean {
13
- const result = parseSfc(vueFileContents)
14
- const script = result.descriptor.scriptSetup?.content
15
- if (!script) {
16
- return false
17
- }
18
- const sourceFile = ts.createSourceFile(
19
- 'temp.ts',
20
- script,
21
- ts.ScriptTarget.ES2015,
22
- true,
23
- )
24
-
25
- let isCalled = false
26
-
27
- function visit(node: ts.Node) {
28
- if (
29
- ts.isCallExpression(node) &&
30
- node.expression.getText(sourceFile) === functionName
31
- ) {
32
- isCalled = true
33
- }
34
-
35
- if (!isCalled) {
36
- ts.forEachChild(node, visit)
37
- }
38
- }
39
-
40
- ts.forEachChild(sourceFile, visit)
41
-
42
- return isCalled
43
- }
44
-
45
- describe('The Nuxt page component', async () => {
46
- const pageComponentFiles = await glob(
47
- path.resolve(__dirname, './../**/*.vue'),
48
- {},
49
- ).then((pageFilePaths) => {
50
- console.log(pageFilePaths)
51
- return Promise.all(
52
- pageFilePaths.map((filePath) => {
53
- return fsp.readFile(filePath, { encoding: 'utf8' }).then((content) => {
54
- return {
55
- filePath,
56
- content,
57
- }
58
- })
59
- }),
60
- )
61
- })
62
-
63
- pageComponentFiles.forEach(({ filePath, content }) => {
64
- it(`"${filePath}" should call useDrupalRouteQuery()`, () => {
65
- expect(functionIsCalledAtLeastOnce(content, 'useDrupalRoute')).toEqual(
66
- true,
67
- )
68
- })
69
- it(`"${filePath}" should call setBreadcrumbLinksFromRoute()`, () => {
70
- expect(
71
- functionIsCalledAtLeastOnce(content, 'setBreadcrumbLinksFromRoute') ||
72
- functionIsCalledAtLeastOnce(content, 'setBreadcrumbLinks') ||
73
- functionIsCalledAtLeastOnce(content, 'useDrupalRoute'),
74
- ).toEqual(true)
75
- })
76
- })
77
- })