@myelophone/nuxt 0.18.2
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.
- package/.devcontainer/Dockerfile +7 -0
- package/.devcontainer/devcontainer.json +21 -0
- package/.editorconfig +43 -0
- package/.github/workflows/package.yml +73 -0
- package/.nuxtignore +6 -0
- package/.releaserc.js +132 -0
- package/.yarn/releases/yarn-4.18.0.cjs +1000 -0
- package/.yarnrc.yml +8 -0
- package/CHANGELOG.md +141 -0
- package/LICENSE +77 -0
- package/README.md +3004 -0
- package/app/app.vue +455 -0
- package/app/assets/css/animation.css +81 -0
- package/app/assets/css/backgrounds.css +57 -0
- package/app/assets/css/base.css +182 -0
- package/app/assets/css/index.css +9 -0
- package/app/assets/css/links.css +12 -0
- package/app/assets/css/multimedia.css +102 -0
- package/app/assets/css/preloader.css +68 -0
- package/app/assets/css/print.css +40 -0
- package/app/assets/css/tailwind.css +20 -0
- package/app/assets/css/theme.css +29 -0
- package/app/components/consent/GoogleMap.vue +59 -0
- package/app/components/consent/Youtube.vue +27 -0
- package/app/components/cookie/Banner.vue +70 -0
- package/app/components/cookie/ConsentWrapper.vue +71 -0
- package/app/components/cookie/PrivacyPolicy.vue +179 -0
- package/app/components/cookie/SettingsModal.vue +387 -0
- package/app/components/grid/Col.vue +262 -0
- package/app/components/grid/Container.vue +236 -0
- package/app/components/grid/Row.vue +248 -0
- package/app/components/grid/Stack.vue +233 -0
- package/app/components/myelophone/Copyright.vue +5 -0
- package/app/components/myelophone/Welcome.vue +107 -0
- package/app/components/page/FullscreenPreloader.vue +177 -0
- package/app/components/page/Preloader.vue +18 -0
- package/app/components/page/ReadyLocalized.vue +19 -0
- package/app/components/ready/.gitkeep +0 -0
- package/app/components/safe/Email.vue +52 -0
- package/app/components/safe/ImgWithLoader.vue +180 -0
- package/app/components/safe/NuxtImg.vue +25 -0
- package/app/components/safe/NuxtPicture.vue +29 -0
- package/app/components/section/.gitkeep +0 -0
- package/app/components/seo/BrandInfo.vue +76 -0
- package/app/components/seo/ContentNoIndex.vue +35 -0
- package/app/components/seo/NoIndex.vue +22 -0
- package/app/components/seo/OrgInfo.vue +130 -0
- package/app/components/seo/ProfileInfo.vue +137 -0
- package/app/components/ui/Accordion.vue +163 -0
- package/app/components/ui/Alert.vue +179 -0
- package/app/components/ui/Avatar.vue +88 -0
- package/app/components/ui/Badge.vue +150 -0
- package/app/components/ui/Banner.vue +133 -0
- package/app/components/ui/Button.vue +175 -0
- package/app/components/ui/Card.vue +66 -0
- package/app/components/ui/Checkbox.vue +134 -0
- package/app/components/ui/Chip.vue +136 -0
- package/app/components/ui/CommandPalette.vue +434 -0
- package/app/components/ui/Console.vue +583 -0
- package/app/components/ui/CursorCreative.vue +148 -0
- package/app/components/ui/FeatureAccordion.vue +165 -0
- package/app/components/ui/FileUpload.vue +705 -0
- package/app/components/ui/GeoDependent.vue +72 -0
- package/app/components/ui/Heading.vue +51 -0
- package/app/components/ui/Icon.vue +42 -0
- package/app/components/ui/Icon8.vue +39 -0
- package/app/components/ui/Input.vue +88 -0
- package/app/components/ui/LangLink.vue +34 -0
- package/app/components/ui/LangVisible.vue +33 -0
- package/app/components/ui/LanguageSelect.vue +202 -0
- package/app/components/ui/LightBox.vue +155 -0
- package/app/components/ui/LocalTime.vue +170 -0
- package/app/components/ui/Modal.vue +161 -0
- package/app/components/ui/Popup.vue +200 -0
- package/app/components/ui/PostContent.server.vue +23 -0
- package/app/components/ui/ProtectedEmail.vue +52 -0
- package/app/components/ui/RelativeTime.vue +141 -0
- package/app/components/ui/ScheduledContent.vue +150 -0
- package/app/components/ui/ScrollToTop.client.vue +48 -0
- package/app/components/ui/SegmentedControl.vue +148 -0
- package/app/components/ui/SiteSearch.vue +1191 -0
- package/app/components/ui/Skeleton.vue +91 -0
- package/app/components/ui/SmartContrast.vue +74 -0
- package/app/components/ui/SnapContainer.vue +222 -0
- package/app/components/ui/SnapSection.vue +294 -0
- package/app/components/ui/SonnerStyle.vue +7 -0
- package/app/components/ui/SplitSection.vue +99 -0
- package/app/components/ui/Steps.vue +858 -0
- package/app/components/ui/StickyWrapper.vue +46 -0
- package/app/components/ui/Table.vue +251 -0
- package/app/components/ui/Tabs.vue +451 -0
- package/app/components/ui/TextColumn.vue +36 -0
- package/app/components/ui/Textarea.vue +251 -0
- package/app/components/ui/Toggler.vue +40 -0
- package/app/components/ui/Tooltip.vue +524 -0
- package/app/components/ui/TruncateText.vue +105 -0
- package/app/components/ui/ViewportSpacer.vue +72 -0
- package/app/components/view/AnimatedCounter.vue +121 -0
- package/app/components/view/AnnouncementBar.vue +104 -0
- package/app/components/view/AvatarGroup.vue +104 -0
- package/app/components/view/Breadcrumbs.vue +97 -0
- package/app/components/view/ContentWithToc.vue +152 -0
- package/app/components/view/Copyright.vue +68 -0
- package/app/components/view/CountdownTimer.vue +184 -0
- package/app/components/view/CreativeCTA.vue +143 -0
- package/app/components/view/CurrencySelect.vue +254 -0
- package/app/components/view/FeatureBoxGrid.vue +142 -0
- package/app/components/view/HorizontalMenu.vue +97 -0
- package/app/components/view/ImageCompare.vue +141 -0
- package/app/components/view/ImgSlider.vue +333 -0
- package/app/components/view/InfiniteMarquee.vue +147 -0
- package/app/components/view/InfoBar.vue +86 -0
- package/app/components/view/LogoGrid.vue +106 -0
- package/app/components/view/LogoSlider.vue +83 -0
- package/app/components/view/NotFound.vue +81 -0
- package/app/components/view/PartialBackground.vue +313 -0
- package/app/components/view/QuoteBig.vue +111 -0
- package/app/components/view/ResponsiveMenu.vue +219 -0
- package/app/components/view/ReviewsSlider.vue +230 -0
- package/app/components/view/SocialBar.vue +78 -0
- package/app/components/view/StickyHeadingContent.vue +158 -0
- package/app/components/view/TallyForm.vue +295 -0
- package/app/components/view/WarningOutdated.vue +113 -0
- package/app/composables/useApi.ts +88 -0
- package/app/composables/useAppSeo.ts +78 -0
- package/app/composables/useBreadcrumbs.ts +106 -0
- package/app/composables/useChangeUrl.ts +73 -0
- package/app/composables/useCommand.ts +28 -0
- package/app/composables/useCookieControl.ts +111 -0
- package/app/composables/useCookieModal.ts +9 -0
- package/app/composables/useDevice.ts +109 -0
- package/app/composables/useGeoFetch.ts +139 -0
- package/app/composables/useLoadScript.ts +36 -0
- package/app/composables/useModalState.ts +37 -0
- package/app/composables/useMultiLang.ts +278 -0
- package/app/composables/useNetwork.ts +49 -0
- package/app/composables/useNuxtVersion.ts +5 -0
- package/app/composables/usePiniaStore.ts +5 -0
- package/app/composables/usePopupControl.ts +57 -0
- package/app/composables/useQuery.ts +307 -0
- package/app/composables/useReadyPage.ts +182 -0
- package/app/composables/useSafeList.ts +90 -0
- package/app/composables/useScriptLoader.ts +221 -0
- package/app/composables/useSiteSearch.ts +32 -0
- package/app/composables/useSnapScroll.ts +24 -0
- package/app/composables/useStatic.ts +5 -0
- package/app/composables/useStorage.ts +252 -0
- package/app/composables/useStoreBroadcast.ts +146 -0
- package/app/composables/useThemeSync.ts +81 -0
- package/app/constants/layout.ts +109 -0
- package/app/constants/predefinedCookieScripts.ts +1222 -0
- package/app/constants/ui-events.ts +1 -0
- package/app/error.vue +169 -0
- package/app/layouts/default-blog.vue +5 -0
- package/app/layouts/default.vue +3 -0
- package/app/locales/en/commands.json +5 -0
- package/app/locales/en/cookies.json +182 -0
- package/app/locales/en/error.json +4 -0
- package/app/locales/en/interface.json +33 -0
- package/app/locales/en/myelophone.json +8 -0
- package/app/locales/en/outdated.json +5 -0
- package/app/locales/en/times.json +18 -0
- package/app/locales/pl/commands.json +5 -0
- package/app/locales/pl/cookies.json +182 -0
- package/app/locales/pl/error.json +4 -0
- package/app/locales/pl/interface.json +33 -0
- package/app/locales/pl/myelophone.json +8 -0
- package/app/locales/pl/outdated.json +5 -0
- package/app/locales/pl/times.json +18 -0
- package/app/locales/ru/commands.json +5 -0
- package/app/locales/ru/cookies.json +182 -0
- package/app/locales/ru/error.json +4 -0
- package/app/locales/ru/interface.json +33 -0
- package/app/locales/ru/myelophone.json +8 -0
- package/app/locales/ru/outdated.json +5 -0
- package/app/locales/ru/times.json +18 -0
- package/app/middleware/blog-layout.ts +28 -0
- package/app/middleware/i18n.global.ts +17 -0
- package/app/middleware/not-found-status.ts +11 -0
- package/app/modules/default-blog/index.ts +39 -0
- package/app/modules/default-blog/posts.ts +80 -0
- package/app/modules/default-sitemap/index.ts +116 -0
- package/app/modules/default-sitemap/runtime/sitemap.get.ts +42 -0
- package/app/modules/fullscreen-preloader/module.ts +43 -0
- package/app/modules/htaccess/.htaccess +38 -0
- package/app/modules/htaccess/index.ts +23 -0
- package/app/modules/i18n-shaker.mjs +221 -0
- package/app/modules/multi18n/module.ts +71 -0
- package/app/modules/myelophone-config/module.ts +241 -0
- package/app/pages/[...all].vue +9 -0
- package/app/pages/index.vue +3 -0
- package/app/pages/post/[...slug].vue +30 -0
- package/app/plugins/bfcache-refresh.client.ts +9 -0
- package/app/plugins/canonical.ts +30 -0
- package/app/plugins/csp-nonce.server.ts +41 -0
- package/app/plugins/multi18n.client.ts +21 -0
- package/app/plugins/multi18n.server.ts +15 -0
- package/app/plugins/nuxt-version.client.ts +4 -0
- package/app/plugins/restore.client.ts +21 -0
- package/app/plugins/reveal.ts +89 -0
- package/app/plugins/url-helper.client.ts +66 -0
- package/app/server/api/exchange-rates.get.ts +216 -0
- package/app/server/api/healthz.ts +1 -0
- package/app/server/api/logout.post.ts +6 -0
- package/app/server/middleware/normalize-url.ts +14 -0
- package/app/server/middleware/security-headers.ts +147 -0
- package/app/server/middleware/url-helper.ts +43 -0
- package/app/server/plugins/clean-html-spaces.ts +15 -0
- package/app/server/plugins/clean-styles.ts +94 -0
- package/app/server/plugins/compression.ts +122 -0
- package/app/server/plugins/css-preload.ts +26 -0
- package/app/server/plugins/early-hints.ts +31 -0
- package/app/server/plugins/force-noindex.ts +43 -0
- package/app/server/plugins/html-one-line.ts +17 -0
- package/app/server/plugins/inline-style.ts +7 -0
- package/app/server/routes/healthz.get.ts +1 -0
- package/app/server/tsconfig.json +3 -0
- package/app/stores/cart.ts +945 -0
- package/app/stores/commands.ts +43 -0
- package/app/stores/device.ts +156 -0
- package/app/stores/querySync.ts +5 -0
- package/app/stores/settings.ts +145 -0
- package/app/stores/user.ts +607 -0
- package/app/types/cookie.ts +89 -0
- package/app/types/myelophone.d.ts +87 -0
- package/app/types/site-search.ts +110 -0
- package/app/utils/asyncRefresh.ts +4 -0
- package/app/utils/blog.server.ts +142 -0
- package/app/utils/jsonLd.ts +56 -0
- package/app/utils/myelophoneConfig.ts +4 -0
- package/app/utils/sortBy.ts +18 -0
- package/app/utils/transliterate.ts +75 -0
- package/app/utils/ytVideo.ts +37 -0
- package/app/workers/site-search.worker.ts +661 -0
- package/biome.json +94 -0
- package/commitlint.config.js +3 -0
- package/nuxt.config.ts +539 -0
- package/package.json +101 -0
- package/playground/content/.gitkeep +0 -0
- package/playground/locales/.gitkeep +0 -0
- package/playground/myelophone.dev.ts +45 -0
- package/playground/nuxt.config.ts +105 -0
- package/playground/package.json +5 -0
- package/playground/pages/.gitkeep +0 -0
- package/playground/tsconfig.json +3 -0
- package/playwright.config.ts +23 -0
- package/public/browsers/chrome.svg +77 -0
- package/public/browsers/edge.svg +98 -0
- package/public/browsers/firefox.svg +300 -0
- package/public/favicon.ico +0 -0
- package/public/myelophone_eng.png +0 -0
- package/public/myelophone_eng_white.png +0 -0
- package/spa-loading-template.html +72 -0
- package/tests/home.spec.ts +9 -0
- package/tests/utils.ts +23 -0
- package/tsconfig.json +16 -0
- package/vite/plugins/clean-css.ts +190 -0
- package/vite/plugins/postcss-add-viewportunits.ts +33 -0
- package/vite/plugins/postcss-viewport-fallback.ts +49 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { COL_SPAN, COL_SPAN_SM, COL_ORDER } from "~/constants/layout";
|
|
3
|
+
import type { LayoutOrder } from "~/constants/layout";
|
|
4
|
+
import { getYoutubeEmbed, getYoutubePoster } from "~/utils/ytVideo";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
span?: keyof typeof COL_SPAN;
|
|
8
|
+
smSpan?: keyof typeof COL_SPAN_SM;
|
|
9
|
+
mdSpan?: keyof typeof COL_SPAN;
|
|
10
|
+
smOrder?: LayoutOrder;
|
|
11
|
+
class?: string;
|
|
12
|
+
id?: string;
|
|
13
|
+
hideOnMobile?: boolean;
|
|
14
|
+
hideOnDesktop?: boolean;
|
|
15
|
+
bgColor?: string;
|
|
16
|
+
bgImage?: string;
|
|
17
|
+
bgImageSm?: string;
|
|
18
|
+
bgGradient?: string;
|
|
19
|
+
bgGradientSm?: string;
|
|
20
|
+
bgSize?: string;
|
|
21
|
+
bgSizeSm?: string;
|
|
22
|
+
bgVideo?: string;
|
|
23
|
+
bgVideoSm?: string;
|
|
24
|
+
bgVideoPoster?: string;
|
|
25
|
+
bgVideoPosterSm?: string;
|
|
26
|
+
bgYoutube?: string;
|
|
27
|
+
bgYoutubeSm?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
31
|
+
span: 12,
|
|
32
|
+
hideOnMobile: false,
|
|
33
|
+
hideOnDesktop: false,
|
|
34
|
+
bgSize: "cover",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const hasVideo = computed(() => {
|
|
38
|
+
const hasYt =
|
|
39
|
+
(props.bgYoutube && props.bgYoutube !== "none") ||
|
|
40
|
+
(props.bgYoutubeSm && props.bgYoutubeSm !== "none");
|
|
41
|
+
if (hasYt) return true;
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
(props.bgVideo && props.bgVideo !== "none") ||
|
|
45
|
+
(props.bgVideoSm && props.bgVideoSm !== "none")
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const classes = computed(() => {
|
|
50
|
+
const result: string[] = [];
|
|
51
|
+
|
|
52
|
+
if (bgStyles.value || hasVideo.value)
|
|
53
|
+
result.push("layout-col-root relative overflow-hidden");
|
|
54
|
+
|
|
55
|
+
if (props.bgGradient || props.bgGradientSm) {
|
|
56
|
+
result.push("has-gradient-overlay");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (props.hideOnMobile) {
|
|
60
|
+
result.push("hidden md:flex");
|
|
61
|
+
} else if (props.hideOnDesktop) {
|
|
62
|
+
result.push("flex md:hidden");
|
|
63
|
+
} else {
|
|
64
|
+
result.push("flex");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
result.push("flex-col");
|
|
68
|
+
|
|
69
|
+
result.push(
|
|
70
|
+
"md:group-[.group\\/equal]:self-stretch md:group-[.group\\/equal]:min-h-0",
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
if (props.smSpan) {
|
|
74
|
+
result.push(COL_SPAN_SM[props.smSpan]);
|
|
75
|
+
} else {
|
|
76
|
+
result.push("basis-full");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (props.span) {
|
|
80
|
+
result.push(COL_SPAN[props.span]);
|
|
81
|
+
}
|
|
82
|
+
if (props.mdSpan) {
|
|
83
|
+
result.push(COL_SPAN[props.mdSpan]);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (props.smOrder) {
|
|
87
|
+
result.push(COL_ORDER[props.smOrder]);
|
|
88
|
+
result.push("md:order-none");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (props.class) result.push(props.class);
|
|
92
|
+
|
|
93
|
+
return result.join(" ");
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const bgStyles = computed(() => {
|
|
97
|
+
const styles: Record<string, string> = {};
|
|
98
|
+
|
|
99
|
+
const hasBg =
|
|
100
|
+
props.bgColor ||
|
|
101
|
+
props.bgImage ||
|
|
102
|
+
props.bgImageSm ||
|
|
103
|
+
props.bgGradient ||
|
|
104
|
+
props.bgGradientSm ||
|
|
105
|
+
hasVideo.value;
|
|
106
|
+
if (!hasBg) return null;
|
|
107
|
+
|
|
108
|
+
if (props.bgColor) styles["--bg-color"] = props.bgColor;
|
|
109
|
+
|
|
110
|
+
let img = "";
|
|
111
|
+
if (props.bgImage) {
|
|
112
|
+
img = `url('${props.bgImage}')`;
|
|
113
|
+
} else if (props.bgYoutube && props.bgYoutube !== "none") {
|
|
114
|
+
img = getYoutubePoster(props.bgYoutube);
|
|
115
|
+
} else if (props.bgVideoPoster) {
|
|
116
|
+
img = `url('${props.bgVideoPoster}')`;
|
|
117
|
+
}
|
|
118
|
+
const grad = props.bgGradient || "";
|
|
119
|
+
|
|
120
|
+
styles["--bg-img-desktop"] = img;
|
|
121
|
+
styles["--bg-grad-desktop"] = grad;
|
|
122
|
+
styles["--bg-size-desktop"] = props.bgSize;
|
|
123
|
+
|
|
124
|
+
let imgSm = "";
|
|
125
|
+
if (props.bgImageSm === "none") {
|
|
126
|
+
imgSm = "";
|
|
127
|
+
} else if (props.bgImageSm) {
|
|
128
|
+
imgSm = `url('${props.bgImageSm}')`;
|
|
129
|
+
} else if (props.bgYoutubeSm && props.bgYoutubeSm !== "none") {
|
|
130
|
+
imgSm = getYoutubePoster(props.bgYoutubeSm);
|
|
131
|
+
} else if (props.bgVideoPosterSm) {
|
|
132
|
+
imgSm = `url('${props.bgVideoPosterSm}')`;
|
|
133
|
+
} else {
|
|
134
|
+
imgSm = img;
|
|
135
|
+
}
|
|
136
|
+
const gradSm = props.bgGradientSm || grad;
|
|
137
|
+
|
|
138
|
+
styles["--bg-img-mobile"] = imgSm;
|
|
139
|
+
styles["--bg-grad-mobile"] = gradSm;
|
|
140
|
+
styles["--bg-size-mobile"] = props.bgSizeSm || props.bgSize;
|
|
141
|
+
|
|
142
|
+
return Object.keys(styles).length > 0 ? styles : null;
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const rootRef = ref<HTMLElement | null>(null);
|
|
146
|
+
|
|
147
|
+
const refreshMyVideo = () => {
|
|
148
|
+
const iframe = rootRef.value?.querySelector("iframe");
|
|
149
|
+
if (iframe) {
|
|
150
|
+
const src = iframe.getAttribute("src");
|
|
151
|
+
if (src) iframe.setAttribute("src", src);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
onMounted(() => {
|
|
156
|
+
window.addEventListener("focus", refreshMyVideo);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
onUnmounted(() => {
|
|
160
|
+
window.removeEventListener("focus", refreshMyVideo);
|
|
161
|
+
});
|
|
162
|
+
</script>
|
|
163
|
+
|
|
164
|
+
<template>
|
|
165
|
+
<div
|
|
166
|
+
ref="rootRef"
|
|
167
|
+
:id="id"
|
|
168
|
+
:class="classes"
|
|
169
|
+
v-bind="bgStyles ? { style: bgStyles } : {}"
|
|
170
|
+
>
|
|
171
|
+
<div
|
|
172
|
+
v-if="bgYoutube && bgYoutube !== 'none'"
|
|
173
|
+
class="video-background-container"
|
|
174
|
+
:class="[
|
|
175
|
+
bgYoutubeSm && bgYoutubeSm !== 'none'
|
|
176
|
+
? 'hidden md:block'
|
|
177
|
+
: 'block',
|
|
178
|
+
]"
|
|
179
|
+
>
|
|
180
|
+
<iframe
|
|
181
|
+
:src="getYoutubeEmbed(bgYoutube)!"
|
|
182
|
+
frameborder="0"
|
|
183
|
+
allow="autoplay; encrypted-media"
|
|
184
|
+
loading="lazy"
|
|
185
|
+
></iframe>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<div
|
|
189
|
+
v-if="bgYoutubeSm && bgYoutubeSm !== 'none'"
|
|
190
|
+
class="video-background-container md:hidden"
|
|
191
|
+
>
|
|
192
|
+
<iframe
|
|
193
|
+
:src="getYoutubeEmbed(bgYoutubeSm)!"
|
|
194
|
+
frameborder="0"
|
|
195
|
+
allow="autoplay; encrypted-media"
|
|
196
|
+
loading="lazy"
|
|
197
|
+
></iframe>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<video
|
|
201
|
+
v-if="
|
|
202
|
+
bgVideo &&
|
|
203
|
+
bgVideo !== 'none' &&
|
|
204
|
+
(!bgYoutube || bgYoutube === 'none')
|
|
205
|
+
"
|
|
206
|
+
autoplay
|
|
207
|
+
muted
|
|
208
|
+
loop
|
|
209
|
+
playsinline
|
|
210
|
+
:poster="bgVideoPoster"
|
|
211
|
+
class="absolute inset-0 z-0 h-full w-full object-cover pointer-events-none"
|
|
212
|
+
:class="[
|
|
213
|
+
(bgVideoSm && bgVideoSm !== 'none') ||
|
|
214
|
+
(bgYoutubeSm && bgYoutubeSm !== 'none')
|
|
215
|
+
? 'hidden md:block'
|
|
216
|
+
: 'block',
|
|
217
|
+
]"
|
|
218
|
+
>
|
|
219
|
+
<source :src="bgVideo" />
|
|
220
|
+
</video>
|
|
221
|
+
|
|
222
|
+
<video
|
|
223
|
+
v-if="
|
|
224
|
+
bgVideoSm &&
|
|
225
|
+
bgVideoSm !== 'none' &&
|
|
226
|
+
(!bgYoutubeSm || bgYoutubeSm === 'none')
|
|
227
|
+
"
|
|
228
|
+
autoplay
|
|
229
|
+
muted
|
|
230
|
+
loop
|
|
231
|
+
playsinline
|
|
232
|
+
:poster="bgVideoPosterSm || bgVideoPoster"
|
|
233
|
+
class="absolute inset-0 z-0 h-full w-full object-cover pointer-events-none md:hidden"
|
|
234
|
+
>
|
|
235
|
+
<source :src="bgVideoSm" />
|
|
236
|
+
</video>
|
|
237
|
+
|
|
238
|
+
<slot />
|
|
239
|
+
</div>
|
|
240
|
+
</template>
|
|
241
|
+
|
|
242
|
+
<style>
|
|
243
|
+
.layout-col-root {
|
|
244
|
+
background-color: var(--bg-color, transparent);
|
|
245
|
+
background-image: var(--bg-img-mobile, none);
|
|
246
|
+
background-size: var(--bg-size-mobile, cover);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.layout-col-root.has-gradient-overlay::before {
|
|
250
|
+
background-image: var(--bg-grad-mobile, none);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
@media (min-width: 768px) {
|
|
254
|
+
.layout-col-root {
|
|
255
|
+
background-image: var(--bg-img-desktop, none);
|
|
256
|
+
background-size: var(--bg-size-desktop, cover);
|
|
257
|
+
}
|
|
258
|
+
.layout-col-root.has-gradient-overlay::before {
|
|
259
|
+
background-image: var(--bg-grad-desktop, none);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
</style>
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { LayoutSize } from "~/constants/layout";
|
|
3
|
+
import { getYoutubeEmbed, getYoutubePoster } from "~/utils/ytVideo";
|
|
4
|
+
|
|
5
|
+
import { CONTAINER_MAX_WIDTH, CONTAINER_PADDING_X } from "~/constants/layout";
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
size?: LayoutSize;
|
|
9
|
+
py?: string;
|
|
10
|
+
my?: string;
|
|
11
|
+
mdPy?: string;
|
|
12
|
+
mdMy?: string;
|
|
13
|
+
id?: string;
|
|
14
|
+
class?: string;
|
|
15
|
+
hideOnMobile?: boolean;
|
|
16
|
+
hideOnDesktop?: boolean;
|
|
17
|
+
bgColor?: string;
|
|
18
|
+
bgImage?: string;
|
|
19
|
+
bgImageSm?: string;
|
|
20
|
+
bgGradient?: string;
|
|
21
|
+
bgGradientSm?: string;
|
|
22
|
+
bgSize?: string;
|
|
23
|
+
bgSizeSm?: string;
|
|
24
|
+
bgVideo?: string;
|
|
25
|
+
bgVideoSm?: string;
|
|
26
|
+
bgVideoPoster?: string;
|
|
27
|
+
bgVideoPosterSm?: string;
|
|
28
|
+
bgYoutube?: string;
|
|
29
|
+
bgYoutubeSm?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
33
|
+
size: "content",
|
|
34
|
+
hideOnMobile: false,
|
|
35
|
+
hideOnDesktop: false,
|
|
36
|
+
bgSize: "cover",
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const hasVideo = computed(() => {
|
|
40
|
+
const hasYt =
|
|
41
|
+
(props.bgYoutube && props.bgYoutube !== "none") ||
|
|
42
|
+
(props.bgYoutubeSm && props.bgYoutubeSm !== "none");
|
|
43
|
+
if (hasYt) return true;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
(props.bgVideo && props.bgVideo !== "none") ||
|
|
47
|
+
(props.bgVideoSm && props.bgVideoSm !== "none")
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const classes = computed(() => [
|
|
52
|
+
{
|
|
53
|
+
"layout-container-root relative overflow-hidden":
|
|
54
|
+
bgStyles.value || hasVideo.value,
|
|
55
|
+
},
|
|
56
|
+
{ "has-gradient-overlay": props.bgGradient || props.bgGradientSm },
|
|
57
|
+
"mx-auto w-full flex-col",
|
|
58
|
+
props.hideOnMobile ? "hidden md:flex" : "",
|
|
59
|
+
props.hideOnDesktop ? "flex md:hidden" : "",
|
|
60
|
+
!props.hideOnMobile && !props.hideOnDesktop ? "flex" : "",
|
|
61
|
+
CONTAINER_MAX_WIDTH[props.size],
|
|
62
|
+
props.size !== "fullwidth" && CONTAINER_PADDING_X,
|
|
63
|
+
props.py && `py-${props.py}`,
|
|
64
|
+
props.my && `my-${props.my}`,
|
|
65
|
+
props.mdPy && `md:py-${props.mdPy}`,
|
|
66
|
+
props.mdMy && `md:my-${props.mdMy}`,
|
|
67
|
+
props.class,
|
|
68
|
+
]);
|
|
69
|
+
|
|
70
|
+
const bgStyles = computed(() => {
|
|
71
|
+
const styles: Record<string, string> = {};
|
|
72
|
+
|
|
73
|
+
const hasBg =
|
|
74
|
+
props.bgColor ||
|
|
75
|
+
props.bgImage ||
|
|
76
|
+
props.bgImageSm ||
|
|
77
|
+
props.bgGradient ||
|
|
78
|
+
props.bgGradientSm ||
|
|
79
|
+
hasVideo.value;
|
|
80
|
+
if (!hasBg) return null;
|
|
81
|
+
|
|
82
|
+
if (props.bgColor) styles["--bg-color"] = props.bgColor;
|
|
83
|
+
|
|
84
|
+
let img = "";
|
|
85
|
+
if (props.bgImage) {
|
|
86
|
+
img = `url('${props.bgImage}')`;
|
|
87
|
+
} else if (props.bgYoutube && props.bgYoutube !== "none") {
|
|
88
|
+
img = getYoutubePoster(props.bgYoutube);
|
|
89
|
+
} else if (props.bgVideoPoster) {
|
|
90
|
+
img = `url('${props.bgVideoPoster}')`;
|
|
91
|
+
}
|
|
92
|
+
const grad = props.bgGradient || "";
|
|
93
|
+
|
|
94
|
+
styles["--bg-img-desktop"] = img;
|
|
95
|
+
styles["--bg-grad-desktop"] = grad;
|
|
96
|
+
styles["--bg-size-desktop"] = props.bgSize;
|
|
97
|
+
|
|
98
|
+
let imgSm = "";
|
|
99
|
+
if (props.bgImageSm === "none") {
|
|
100
|
+
imgSm = "";
|
|
101
|
+
} else if (props.bgImageSm) {
|
|
102
|
+
imgSm = `url('${props.bgImageSm}')`;
|
|
103
|
+
} else if (props.bgYoutubeSm && props.bgYoutubeSm !== "none") {
|
|
104
|
+
imgSm = getYoutubePoster(props.bgYoutubeSm);
|
|
105
|
+
} else if (props.bgVideoPosterSm) {
|
|
106
|
+
imgSm = `url('${props.bgVideoPosterSm}')`;
|
|
107
|
+
} else {
|
|
108
|
+
imgSm = img;
|
|
109
|
+
}
|
|
110
|
+
const gradSm = props.bgGradientSm || grad;
|
|
111
|
+
|
|
112
|
+
styles["--bg-img-mobile"] = imgSm;
|
|
113
|
+
styles["--bg-grad-mobile"] = gradSm;
|
|
114
|
+
styles["--bg-size-mobile"] = props.bgSizeSm || props.bgSize;
|
|
115
|
+
|
|
116
|
+
return Object.keys(styles).length > 0 ? styles : null;
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const rootRef = ref<HTMLElement | null>(null);
|
|
120
|
+
|
|
121
|
+
const refreshMyVideo = () => {
|
|
122
|
+
const iframe = rootRef.value?.querySelector("iframe");
|
|
123
|
+
if (iframe) {
|
|
124
|
+
const src = iframe.getAttribute("src");
|
|
125
|
+
if (src) iframe.setAttribute("src", src);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
onMounted(() => {
|
|
130
|
+
window.addEventListener("focus", refreshMyVideo);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
onUnmounted(() => {
|
|
134
|
+
window.removeEventListener("focus", refreshMyVideo);
|
|
135
|
+
});
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
<template>
|
|
139
|
+
<div
|
|
140
|
+
ref="rootRef"
|
|
141
|
+
:id="id"
|
|
142
|
+
:class="classes"
|
|
143
|
+
v-bind="bgStyles ? { style: bgStyles } : {}"
|
|
144
|
+
>
|
|
145
|
+
<div
|
|
146
|
+
v-if="bgYoutube && bgYoutube !== 'none'"
|
|
147
|
+
class="video-background-container"
|
|
148
|
+
:class="[
|
|
149
|
+
bgYoutubeSm && bgYoutubeSm !== 'none'
|
|
150
|
+
? 'hidden md:block'
|
|
151
|
+
: 'block',
|
|
152
|
+
]"
|
|
153
|
+
>
|
|
154
|
+
<iframe
|
|
155
|
+
:src="getYoutubeEmbed(bgYoutube)!"
|
|
156
|
+
frameborder="0"
|
|
157
|
+
allow="autoplay; encrypted-media"
|
|
158
|
+
loading="lazy"
|
|
159
|
+
></iframe>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<div
|
|
163
|
+
v-if="bgYoutubeSm && bgYoutubeSm !== 'none'"
|
|
164
|
+
class="video-background-container md:hidden"
|
|
165
|
+
>
|
|
166
|
+
<iframe
|
|
167
|
+
:src="getYoutubeEmbed(bgYoutubeSm)!"
|
|
168
|
+
frameborder="0"
|
|
169
|
+
allow="autoplay; encrypted-media"
|
|
170
|
+
loading="lazy"
|
|
171
|
+
></iframe>
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
<video
|
|
175
|
+
v-if="
|
|
176
|
+
bgVideo &&
|
|
177
|
+
bgVideo !== 'none' &&
|
|
178
|
+
(!bgYoutube || bgYoutube === 'none')
|
|
179
|
+
"
|
|
180
|
+
autoplay
|
|
181
|
+
muted
|
|
182
|
+
loop
|
|
183
|
+
playsinline
|
|
184
|
+
:poster="bgVideoPoster"
|
|
185
|
+
class="absolute inset-0 z-0 h-full w-full object-cover pointer-events-none"
|
|
186
|
+
:class="[
|
|
187
|
+
(bgVideoSm && bgVideoSm !== 'none') ||
|
|
188
|
+
(bgYoutubeSm && bgYoutubeSm !== 'none')
|
|
189
|
+
? 'hidden md:block'
|
|
190
|
+
: 'block',
|
|
191
|
+
]"
|
|
192
|
+
>
|
|
193
|
+
<source :src="bgVideo" />
|
|
194
|
+
</video>
|
|
195
|
+
|
|
196
|
+
<video
|
|
197
|
+
v-if="
|
|
198
|
+
bgVideoSm &&
|
|
199
|
+
bgVideoSm !== 'none' &&
|
|
200
|
+
(!bgYoutubeSm || bgYoutubeSm === 'none')
|
|
201
|
+
"
|
|
202
|
+
autoplay
|
|
203
|
+
muted
|
|
204
|
+
loop
|
|
205
|
+
playsinline
|
|
206
|
+
:poster="bgVideoPosterSm || bgVideoPoster"
|
|
207
|
+
class="absolute inset-0 z-0 h-full w-full object-cover pointer-events-none md:hidden"
|
|
208
|
+
>
|
|
209
|
+
<source :src="bgVideoSm" />
|
|
210
|
+
</video>
|
|
211
|
+
|
|
212
|
+
<slot />
|
|
213
|
+
</div>
|
|
214
|
+
</template>
|
|
215
|
+
|
|
216
|
+
<style>
|
|
217
|
+
.layout-container-root {
|
|
218
|
+
background-color: var(--bg-color, transparent);
|
|
219
|
+
background-image: var(--bg-img-mobile, none);
|
|
220
|
+
background-size: var(--bg-size-mobile, cover);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.layout-container-root.has-gradient-overlay::before {
|
|
224
|
+
background-image: var(--bg-grad-mobile, none);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@media (min-width: 768px) {
|
|
228
|
+
.layout-container-root {
|
|
229
|
+
background-image: var(--bg-img-desktop, none);
|
|
230
|
+
background-size: var(--bg-size-desktop, cover);
|
|
231
|
+
}
|
|
232
|
+
.layout-container-root.has-gradient-overlay::before {
|
|
233
|
+
background-image: var(--bg-grad-desktop, none);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
</style>
|