create-nuxt-base 0.2.1 → 0.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 (34) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/nuxt-base-template/.env.example +0 -1
  3. package/nuxt-base-template/package-lock.json +287 -269
  4. package/nuxt-base-template/package.json +7 -7
  5. package/nuxt-base-template/src/app.vue +6 -7
  6. package/nuxt-base-template/src/pages/index.vue +0 -30
  7. package/package.json +1 -1
  8. package/nuxt-base-template/src/components/SocialMediaBubble.vue +0 -16
  9. package/nuxt-base-template/src/components/base/BaseAccordion.vue +0 -55
  10. package/nuxt-base-template/src/components/base/BaseButton.vue +0 -103
  11. package/nuxt-base-template/src/components/base/BaseContainer.vue +0 -5
  12. package/nuxt-base-template/src/components/base/BaseContextMenuContainer.vue +0 -61
  13. package/nuxt-base-template/src/components/base/BaseInfinityList.vue +0 -34
  14. package/nuxt-base-template/src/components/base/BaseProgressbar.vue +0 -64
  15. package/nuxt-base-template/src/components/base/BaseToggle.vue +0 -27
  16. package/nuxt-base-template/src/components/form/FormInput.vue +0 -34
  17. package/nuxt-base-template/src/components/form/FormPassword.vue +0 -47
  18. package/nuxt-base-template/src/components/form/FormSelect.vue +0 -40
  19. package/nuxt-base-template/src/components/form/FormSubmit.vue +0 -18
  20. package/nuxt-base-template/src/components/form/FormTextarea.vue +0 -36
  21. package/nuxt-base-template/src/components/form/FormToggle.vue +0 -27
  22. package/nuxt-base-template/src/components/modal/Modal.vue +0 -48
  23. package/nuxt-base-template/src/components/modal/ModalConfirm.vue +0 -38
  24. package/nuxt-base-template/src/components/modal/ModalContainer.vue +0 -7
  25. package/nuxt-base-template/src/components/modal/ModalInfo.vue +0 -22
  26. package/nuxt-base-template/src/components/modal/ModalShare.vue +0 -63
  27. package/nuxt-base-template/src/components/notification/Notification.vue +0 -82
  28. package/nuxt-base-template/src/components/notification/NotificationContainer.vue +0 -40
  29. package/nuxt-base-template/src/components/pwa/pwa-install-banner.vue +0 -224
  30. /package/nuxt-base-template/src/components/{transition → Transition}/TransitionFade.vue +0 -0
  31. /package/nuxt-base-template/src/components/{transition → Transition}/TransitionFadeScale.vue +0 -0
  32. /package/nuxt-base-template/src/components/{transition → Transition}/TransitionSlide.vue +0 -0
  33. /package/nuxt-base-template/src/components/{transition → Transition}/TransitionSlideBottom.vue +0 -0
  34. /package/nuxt-base-template/src/components/{transition → Transition}/TransitionSlideRevert.vue +0 -0
@@ -1,27 +0,0 @@
1
- <script setup lang="ts">
2
- import { ErrorMessage, useField } from 'vee-validate';
3
-
4
- const props = defineProps<{
5
- disabled?: boolean;
6
- label?: string;
7
- name: string;
8
- }>();
9
-
10
- const { handleChange, meta, value, setTouched } = useField(() => props.name);
11
-
12
- watch(
13
- () => value.value,
14
- () => {
15
- handleChange(value.value);
16
- setTouched(true);
17
- }
18
- );
19
- </script>
20
-
21
- <template>
22
- <div class="relative mt-3 pb-2">
23
- <label v-if="label" :for="name" class="block text-sm font-medium leading-6 text-foreground">{{ label }}{{ meta.required ? '*' : '' }}</label>
24
- <BaseToggle v-model:active="value" :disabled="disabled" />
25
- <ErrorMessage class="absolute -bottom-2.5 text-xs font-light text-red-600" :name="name" />
26
- </div>
27
- </template>
@@ -1,48 +0,0 @@
1
- <script setup lang="ts">
2
- import { twMerge } from 'tailwind-merge';
3
-
4
- defineOptions({
5
- inheritAttrs: false,
6
- });
7
-
8
- const props = withDefaults(
9
- defineProps<{
10
- show: boolean;
11
- showInner: boolean;
12
- backgroundColor?: string;
13
- size?: 'auto' | 'sm' | 'md' | 'lg';
14
- }>(),
15
- {
16
- backgroundColor: '#FFF',
17
- size: 'auto',
18
- }
19
- );
20
-
21
- const emit = defineEmits<{
22
- (event: 'cancel'): void;
23
- }>();
24
-
25
- const attributes = useAttrs() as { class: string };
26
- const sizeClasses: Record<typeof props.size, string> = {
27
- auto: 'w-4/5 md:w-auto',
28
- sm: 'w-4/5 md:w-1/4',
29
- md: 'w-4/5 md:w-3/6',
30
- lg: 'w-4/5 md:w-4/5',
31
- };
32
- const defaultClasses = 'duration-200 w-full overflow-hidden rounded-[20px] p-4 bg-[--bg-color] bg-background flex flex-col gap-4';
33
- const classes = twMerge(defaultClasses, sizeClasses[props.size], attributes?.class);
34
- </script>
35
-
36
- <template>
37
- <div class="relative z-50" aria-labelledby="modal-title" role="dialog" aria-modal="true" :style="`--bg-color: ${props.backgroundColor};`">
38
- <TransitionFade>
39
- <div v-show="show" class="fixed inset-0 bg-background/30 backdrop-blur-sm transition-opacity flex justify-center items-center" @click="emit('cancel')">
40
- <TransitionFade class="w-full flex justify-center">
41
- <div v-show="showInner" :class="classes" @click.stop>
42
- <slot></slot>
43
- </div>
44
- </TransitionFade>
45
- </div>
46
- </TransitionFade>
47
- </div>
48
- </template>
@@ -1,38 +0,0 @@
1
- <script setup lang="ts">
2
- import type { ModalContext } from '~/composables/use-modal';
3
-
4
- const props = defineProps<{
5
- context: ModalContext<{
6
- cancelText: string;
7
- confirmColor?: 'primary' | 'secondary' | 'green' | 'yellow' | 'lightprimary' | 'danger';
8
- confirmText: string;
9
- text: string;
10
- title: string;
11
- }>;
12
- }>();
13
- const { close } = useModal();
14
- </script>
15
-
16
- <template>
17
- <Modal class="p-10 relative" :show="context.show" :show-inner="context.showInner" :size="context.size" @cancel="context.closable ? close() : null">
18
- <div class="flex items-center justify-center mb-2">
19
- <div class="font-semibold text-xl text-foreground">
20
- {{ context?.data?.title }}
21
- </div>
22
- <button class="absolute top-5 right-5" @click="close()">
23
- <span class="i-bi-x text-2xl hover:text-primary-500 duration-200"></span>
24
- </button>
25
- </div>
26
- <div class="mb-5 text-foreground">
27
- {{ context?.data?.text }}
28
- </div>
29
- <div class="grid grid-cols-1 md:grid-cols-2 gap-2">
30
- <BaseButton appearance="outline" color="primary" @click="context?.confirm?.(false)">
31
- {{ context?.data?.cancelText || 'Abbrechen' }}
32
- </BaseButton>
33
- <BaseButton :color="context?.data?.confirmColor || 'primary'" @click="context?.confirm?.(true)">
34
- {{ context?.data?.confirmText || 'Ok' }}
35
- </BaseButton>
36
- </div>
37
- </Modal>
38
- </template>
@@ -1,7 +0,0 @@
1
- <script setup lang="ts">
2
- const { activeModal } = useModal();
3
- </script>
4
-
5
- <template>
6
- <component :is="activeModal.component" v-if="activeModal" :context="activeModal" />
7
- </template>
@@ -1,22 +0,0 @@
1
- <script setup lang="ts">
2
- import type { ModalContext } from '~/composables/use-modal';
3
-
4
- const props = defineProps<{ context: ModalContext<{ text: string; title: string }> }>();
5
- const { close } = useModal();
6
- </script>
7
-
8
- <template>
9
- <Modal class="p-10 relative" :show="context.show" :show-inner="context.showInner" :size="context.size" @cancel="context.closable ? close() : null">
10
- <div class="flex items-center justify-center mb-2">
11
- <div class="font-semibold text-xl text-foreground">
12
- {{ context?.data?.title }}
13
- </div>
14
- <button class="absolute top-5 right-5" @click="close()">
15
- <span class="i-bi-x text-2xl hover:text-primary-500 duration-200"></span>
16
- </button>
17
- </div>
18
- <div class="text-center text-foreground mb-6">
19
- {{ context?.data?.text }}
20
- </div>
21
- </Modal>
22
- </template>
@@ -1,63 +0,0 @@
1
- <script setup lang="ts">
2
- import type { ModalContext } from '~/composables/use-modal';
3
- import SocialMediaBubble from '~/components/SocialMediaBubble.vue';
4
-
5
- const props = defineProps<{ context: ModalContext<{ link: string; name: string }> }>();
6
- const { close } = useModal();
7
- const url = ref<string>('');
8
-
9
- onMounted(() => {
10
- url.value = props.context.data?.link ? props.context.data?.link : window.location.href;
11
- });
12
-
13
- const copyUrl = () => {
14
- useClipboard({ source: url.value }).copy();
15
- useNotification().notify({ type: 'success', title: 'Erfolgreich', text: 'Link wurde erfolgreich kopiert!' });
16
- };
17
-
18
- const shareWith = (type: 'mail' | 'whatsapp' | 'facebook' | 'linkedin' | 'twitter') => {
19
- switch (type) {
20
- case 'mail':
21
- open(`mailto:?subject=${props.context.data?.name}&body=${encodeURIComponent(url.value)}`, '_blank');
22
- break;
23
- case 'whatsapp':
24
- open(`https://api.whatsapp.com/send/?text=${encodeURIComponent(url.value)}`, '_blank');
25
- break;
26
- case 'facebook':
27
- open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url.value)}`, '_blank');
28
- break;
29
- case 'linkedin':
30
- open(`https://www.linkedin.com/shareArticle?url=${encodeURIComponent(url.value)}`, '_blank');
31
- break;
32
- case 'twitter':
33
- open(`https://twitter.com/share?url=${encodeURIComponent(url.value)}`, '_blank');
34
- break;
35
- }
36
- };
37
- </script>
38
-
39
- <template>
40
- <Modal class="p-10 relative" :show="context.show" :show-inner="context.showInner" :size="context.size" @cancel="context.closable ? close() : null">
41
- <div class="flex items-center justify-center mb-4">
42
- <div class="font-semibold text-xl text-foreground">Teilen</div>
43
- <button class="absolute top-5 right-5" @click="close()">
44
- <span class="i-bi-x text-2xl hover:text-primary-500"></span>
45
- </button>
46
- </div>
47
- <div class="text-center text-foreground">
48
- <div class="flex justify-around max-w-md mx-auto gap-3 py-2 mb-5 overflow-x-scroll">
49
- <SocialMediaBubble title="E-Mail" bg-color="#bbbbbb" icon="i-bi-envelope" @click="shareWith('mail')" />
50
- <SocialMediaBubble title="Whatsapp" bg-color="#25d366" icon="i-bi-whatsapp" @click="shareWith('whatsapp')" />
51
- <SocialMediaBubble title="Facebook" bg-color="#3b5998" icon="i-bi-facebook" @click="shareWith('facebook')" />
52
- <SocialMediaBubble title="LinkedIn" bg-color="#0a66c2" icon="i-bi-linkedin" @click="shareWith('linkedin')" />
53
- <SocialMediaBubble title="X / Twitter" bg-color="#000000" icon="i-bi-twitter-x" @click="shareWith('twitter')" />
54
- </div>
55
- <div class="flex items-center gap-3 justify-between p-3 border border-border rounded-lg">
56
- <span class="text-ellipsis overflow-hidden">
57
- {{ url }}
58
- </span>
59
- <BaseButton size="sm" @click="copyUrl()"> Kopieren </BaseButton>
60
- </div>
61
- </div>
62
- </Modal>
63
- </template>
@@ -1,82 +0,0 @@
1
- <script setup lang="ts">
2
- const props = defineProps<{
3
- title: string;
4
- text?: string;
5
- duration: number;
6
- type: 'success' | 'error' | 'warning' | 'info';
7
- }>();
8
-
9
- const emit = defineEmits<{
10
- (event: 'close'): void;
11
- }>();
12
-
13
- const process = ref(100);
14
- let durationLeft = props.duration - (500 + 130);
15
- onMounted(() => {
16
- const interval = setInterval(() => {
17
- durationLeft -= 30;
18
- process.value = (durationLeft / props.duration) * 100;
19
- }, 30);
20
- setTimeout(() => {
21
- clearInterval(interval);
22
- emit('close');
23
- }, props.duration);
24
- });
25
-
26
- const icon: Record<typeof props.type, string> = {
27
- success: 'i-bi-check-circle',
28
- error: 'i-bi-exclamation-circle',
29
- warning: 'i-bi-exclamation-triangle',
30
- info: 'i-bi-info-circle',
31
- };
32
-
33
- const accentColor: Record<typeof props.type, string> = {
34
- success: '#059669',
35
- error: '#DC2626',
36
- warning: '#D97706',
37
- info: '#3B82F6',
38
- };
39
- </script>
40
-
41
- <template>
42
- <div
43
- :style="`--accent-color: ${accentColor[props.type]}`"
44
- class="pointer-events-auto relative w-full max-w-sm overflow-hidden rounded-lg bg-white dark:bg-gray-950 shadow-lg ring-1 ring-black ring-opacity-5 z-[99999px]"
45
- >
46
- <div
47
- :style="{
48
- width: `${process}%`
49
- }"
50
- class="bg-[--accent-color] h-[5px] duration-100 transition-[width] w-[width] absolute bottom-0"
51
- ></div>
52
- <div class="p-4">
53
- <div class="flex items-start">
54
- <div class="flex-shrink-0">
55
- <span :class="icon[props.type]" class="h-6 w-6 text-[--accent-color]"></span>
56
- </div>
57
- <div class="ml-3 w-0 flex-1 pt-0.5">
58
- <p class="text-sm font-semibold text-gray-900 dark:text-white">
59
- {{ props.title }}
60
- </p>
61
- <p v-if="props.text" class="mt-1 text-sm text-gray-500 dark:text-white">
62
- {{ props.text }}
63
- </p>
64
- </div>
65
- <div class="ml-4 flex flex-shrink-0">
66
- <button
67
- type="button"
68
- class="inline-flex rounded-md bg-white text-gray-400 dark:bg-gray-100 dark:text-white hover:text-gray-500 focus:outline-none focus:ring-1 focus:ring-primary-500"
69
- @click="emit('close')"
70
- >
71
- <span class="sr-only">Close</span>
72
- <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
73
- <path
74
- d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"
75
- />
76
- </svg>
77
- </button>
78
- </div>
79
- </div>
80
- </div>
81
- </div>
82
- </template>
@@ -1,40 +0,0 @@
1
- <script setup lang="ts">
2
- const { notifications, remove } = useNotification();
3
- </script>
4
-
5
- <template>
6
- <div aria-live="assertive" class="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6 z-[99999]">
7
- <TransitionGroup tag="div" name="list" class="flex w-full flex-col items-center space-y-4 sm:items-end">
8
- <Notification
9
- v-for="notification in notifications"
10
- :key="notification.uuid"
11
- :text="notification.text"
12
- :title="notification.title"
13
- :type="notification.type"
14
- :duration="notification.duration!"
15
- @close="remove(notification.uuid)"
16
- />
17
- </TransitionGroup>
18
- </div>
19
- </template>
20
-
21
- <style>
22
- .list-move,
23
- /* apply transition to moving elements */
24
- .list-enter-active,
25
- .list-leave-active {
26
- transition: all 0.5s ease;
27
- }
28
-
29
- .list-enter-from,
30
- .list-leave-to {
31
- opacity: 0;
32
- transform: translateX(30px);
33
- }
34
-
35
- /* ensure leaving items are taken out of layout flow so that moving
36
- animations can be calculated correctly. */
37
- .list-leave-active {
38
- position: absolute;
39
- }
40
- </style>
@@ -1,224 +0,0 @@
1
- <script setup lang="ts">
2
- const props = withDefaults(
3
- defineProps<{
4
- addHomeButtonLabel?: string;
5
- body?: string;
6
- buttonLabel?: string;
7
- closePrompt?: string;
8
- debug?: boolean;
9
- delay?: number;
10
- iosBackgroundColor?: string;
11
- iosBackgroundColorDark?: string;
12
- iosBorderColor?: string;
13
- iosBorderColorDark?: string;
14
- iosButtonColoDark?: string;
15
- iosButtonColor?: string;
16
- iosOverlayColor?: string;
17
- iosOverlayColorDark?: string;
18
- iosTextColor?: string;
19
- iosTextColorDark?: string;
20
- iosTitleColor?: string;
21
- iosTitleColorDark?: string;
22
- title?: string;
23
- }>(),
24
- {
25
- addHomeButtonLabel: '2) Drücken Sie auf "Zum Home-Bildschirm".',
26
- body: 'Diese Website verfügt über eine App-Funktionalität. Fügen Sie sie zu Ihrem Startbildschirm hinzu, um sie im Vollbildmodus und offline zu nutzen.',
27
- buttonLabel: '1) Drücken Sie die Schaltfläche "Teilen".',
28
- closePrompt: 'Abbrechen',
29
- debug: false,
30
-
31
- delay: 1000,
32
- iosBackgroundColor: 'rgba(255, 255, 255, 0.9)',
33
-
34
- iosBackgroundColorDark: 'rgba(65, 65, 65, 0.7)',
35
- iosBorderColor: 'rgba(60, 60, 67, 0.29)',
36
-
37
- iosBorderColorDark: 'rgba(140, 140, 140, 0.7)',
38
- iosButtonColoDark: 'rgba(9, 132, 255, 1)',
39
-
40
- iosButtonColor: 'rgba(0, 85, 179, 1)',
41
- iosOverlayColor: 'rgba(10, 10, 10, 0.5)',
42
-
43
- iosOverlayColorDark: 'rgba(10, 10, 10, 0.5)',
44
- iosTextColor: 'rgba(60, 60, 67, 0.6)',
45
-
46
- iosTextColorDark: 'rgba(235, 235, 245, 0.6)',
47
- iosTitleColor: 'rgba(0, 0, 0, 1)',
48
-
49
- iosTitleColorDark: 'rgba(255, 255, 255, 1)',
50
- title: 'Zum Startbildschirm hinzufügen',
51
- }
52
- );
53
-
54
- const cssVariables = [
55
- `--ios-overlay: ${props.iosOverlayColor}`,
56
- `--ios-overlay-dark: ${props.iosOverlayColorDark}`,
57
- `--ios-background: ${props.iosBackgroundColor}`,
58
- `--ios-background-dark: ${props.iosBackgroundColorDark}`,
59
- `--ios-button: ${props.iosButtonColor}`,
60
- `--ios-button-dark: ${props.iosButtonColor}`,
61
- `--ios-border: ${props.iosBorderColor}`,
62
- `--ios-border-dark: ${props.iosBorderColorDark}`,
63
- `--ios-title: ${props.iosTitleColor}`,
64
- `--ios-title-dark: ${props.iosTitleColorDark}`,
65
- `--ios-text: ${props.iosTextColor}`,
66
- `--ios-text-dark: ${props.iosTextColorDark}`,
67
- ].join(';');
68
-
69
- const HomeIcon = defineComponent({
70
- render: () =>
71
- h('svg', { fill: 'currentColor', viewBox: '0 0 578 584' }, [
72
- h('path', {
73
- 'clip-rule': 'evenodd',
74
- d: 'M101 35l19-1h333c12 0 23 0 35 3 17 3 34 12 44 27 13 16 16 38 16 58v329c0 19 0 39-8 57a65 65 0 0 1-37 37c-18 7-38 7-57 7H130c-21 1-44 0-63-10-14-7-25-20-30-34-6-15-8-30-8-45V121c1-21 5-44 19-61 13-16 33-23 53-25m7 46c-10 1-19 6-24 14-7 8-9 20-9 31v334c0 12 2 25 10 34 9 10 23 12 35 12h336c14 1 30-3 38-15 6-9 8-20 8-31V125c0-12-2-24-10-33-9-9-22-12-35-12H121l-13 1z',
75
- 'fill-rule': 'evenodd',
76
- }),
77
- h('path', {
78
- 'clip-rule': 'evenodd',
79
- d: 'M271 161c9-11 31-10 38 4 3 5 3 11 3 17v87h88c7 0 16 1 21 7 6 6 7 14 6 22a21 21 0 0 1-10 14c-5 4-11 5-17 5h-88v82c0 7-1 15-6 20-10 10-29 10-37-2-3-6-4-13-4-19v-81h-87c-8-1-17-3-23-9-5-6-6-15-4-22a21 21 0 0 1 11-14c6-3 13-3 19-3h84v-88c0-7 1-14 6-20z',
80
- 'fill-rule': 'evenodd',
81
- }),
82
- ]),
83
- });
84
-
85
- const ShareIcon = defineComponent({
86
- render: () =>
87
- h('svg', { fill: 'currentColor', viewBox: '0 0 566 670' }, [
88
- h('path', {
89
- 'clip-rule': 'evenodd',
90
- d: 'M255 12c4-4 10-8 16-8s12 3 16 8l94 89c3 4 6 7 8 12 2 6 0 14-5 19-7 8-20 9-28 2l-7-7-57-60 2 54v276c0 12-10 22-22 22-12 1-24-10-23-22V110l1-43-60 65c-5 5-13 8-21 6a19 19 0 0 1-16-17c-1-7 2-13 7-18l95-91z',
91
- 'fill-rule': 'evenodd',
92
- }),
93
- h('path', {
94
- 'clip-rule': 'evenodd',
95
- d: 'M43 207c16-17 40-23 63-23h83v46h-79c-12 0-25 3-33 13-8 9-10 21-10 33v260c0 13 0 27 6 38 5 12 18 18 30 19l14 1h302c14 0 28 0 40-8 11-7 16-21 16-34V276c0-11-2-24-9-33-8-10-22-13-34-13h-78v-46h75c13 0 25 1 37 4 16 4 31 13 41 27 11 17 14 37 14 57v280c0 20-3 41-15 58a71 71 0 0 1-45 27c-11 2-23 3-34 3H109c-19-1-40-4-56-15-14-9-23-23-27-38-4-12-5-25-5-38V270c1-22 6-47 22-63z',
96
- 'fill-rule': 'evenodd',
97
- }),
98
- ]),
99
- });
100
-
101
- const showBanner = ref(false);
102
-
103
- watch(
104
- () => showBanner.value,
105
- () => {
106
- if (showBanner.value) {
107
- // Disable scrolling of background
108
- document.body.style.overflowY = 'hidden';
109
- } else {
110
- // Deactivate scrolling of background
111
- document.body.style.overflowY = '';
112
- }
113
- }
114
- );
115
-
116
- interface BeforeInstallPromptEvent {
117
- prompt: () => void;
118
- }
119
- const { storagePrefix } = useRuntimeConfig().public;
120
- const deferredPrompt = ref<BeforeInstallPromptEvent | null>();
121
-
122
- const cancelCookie = () => useCookie(`${storagePrefix}_pwa_prompt_canceled`, { default: () => false });
123
-
124
- function cancel() {
125
- cancelCookie().value = true;
126
- showBanner.value = false;
127
- }
128
-
129
- function deviceCheck() {
130
- const isiOS = /iphone|ipad|ipod/.test(window.navigator.userAgent.toLowerCase());
131
- const isiPadOS = navigator.platform === 'MacIntel' && navigator.maxTouchPoints >= 2;
132
- const isStandalone = 'standalone' in window.navigator && window.navigator.standalone;
133
-
134
- return (isiOS || isiPadOS) && !isStandalone;
135
- }
136
-
137
- function reactivate() {
138
- cancelCookie().value = false;
139
- showBanner.value = true;
140
- }
141
-
142
- function showInAppInstallPromotion() {
143
- if (deferredPrompt.value) {
144
- deferredPrompt.value.prompt();
145
- }
146
- }
147
-
148
- onMounted(() => {
149
- if (!cancelCookie().value) {
150
- showBanner.value = deviceCheck();
151
- }
152
-
153
- // This variable will save the event for later use.
154
- let deferredPrompt;
155
- window.addEventListener('beforeinstallprompt', (e) => {
156
- // Prevents the default mini-infobar or install dialog from appearing on mobile
157
- e.preventDefault();
158
- // Save the event because you'll need to trigger it later.
159
- deferredPrompt = e;
160
- // Show your customized install prompt for your PWA
161
- // Your own UI doesn't have to be a single element, you
162
- // can have buttons in different locations, or wait to prompt
163
- // as part of a critical journey.
164
- showInAppInstallPromotion();
165
- });
166
- });
167
-
168
- defineExpose({
169
- reactivate,
170
- });
171
- </script>
172
-
173
- <template>
174
- <Transition
175
- enter-active-class="ease-out duration-500 delay-500"
176
- enter-from-class="translate-y-full"
177
- enter-to-class="translate-x-0"
178
- leave-active-class="ease-in duration-500"
179
- leave-from-class="translate-x-0"
180
- leave-to-class="translate-y-full"
181
- >
182
- <div v-show="showBanner" :style="cssVariables" class="bottom-0 w-full fixed !z-[9998] p-2 max-w-md mx-auto">
183
- <div class="bg-[var(--ios-background)] backdrop-blur-sm overflow-hidden dark:bg-[var(--ios-background-dark)] rounded-lg">
184
- <div class="flex justify-between border-b border-[var(--ios-border)] dark:border-[var(--ios-border-dark)]">
185
- <h4 class="text-[var(--ios-title)] dark:text-[var(--ios-title-dark)] text-md p-4">
186
- {{ props.title }}
187
- </h4>
188
- <button class="text-[var(--ios-button)] dark:text-[var(--ios-button-dark)] text-base p-4" @click="cancel()">
189
- {{ props.closePrompt }}
190
- </button>
191
- </div>
192
- <div class="px-8 py-4">
193
- <p class="text-[var(--ios-text)] dark:text-[var(--ios-text-dark)] text-center text-sm border-b px-4 pb-4 border-[var(--ios-border)] dark:border-[var(--ios-border-dark)]">
194
- {{ props.body }}
195
- </p>
196
- <div class="flex flex-col gap-4 p-4 pt-8">
197
- <div class="flex justify-start items-center gap-6">
198
- <ShareIcon class="h-8 w-auto text-[var(--ios-button)] dark:text-[var(--ios-button-dark)]" />
199
- <p class="text-sm text-left text-[var(--ios-text)] dark:text-[var(--ios-text-dark)]">
200
- {{ props.buttonLabel }}
201
- </p>
202
- </div>
203
- <div class="flex justify-start items-center gap-6">
204
- <HomeIcon class="h-8 w-auto text-[var(--ios-button)] dark:text-[var(--ios-button-dark)]" />
205
- <p class="text-sm text-left text-[var(--ios-text)] dark:text-[var(--ios-text-dark)]">
206
- {{ props.addHomeButtonLabel }}
207
- </p>
208
- </div>
209
- </div>
210
- </div>
211
- </div>
212
- </div>
213
- </Transition>
214
- <Transition
215
- enter-active-class="ease-out duration-1000"
216
- enter-from-class="opacity-0"
217
- enter-to-class="opacity-100"
218
- leave-active-class="ease-in duration-1000"
219
- leave-from-class="opacity-100"
220
- leave-to-class="opacity-0"
221
- >
222
- <div v-show="showBanner" :style="cssVariables" class="absolute inset-0 bg-black/50 !z-[9997] min-h-screen w-full"></div>
223
- </Transition>
224
- </template>